Thread Rating:
  • 2 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
News Manager Addons plugin
(2018-10-01, 02:37:17)Carlos Wrote: I've not tested, but I think it should work:

- In your NM Addons template code, change:
<li style=...>
<li id="nma_post_{{post_slug}}" style=...>

- Insert this in the <head> section of your template:
<?php if (nm_is_single()) { ?>
#nma_post_<?php nm_post_slug(); ?> { display:none; }
<?php } ?>

It works great, thank you very much!

I had almost the same idea but I just did not know where to put the if-clause...

Hey Guys
i'm quite new to Get Simple and want to use the NewsManager Plugin as an Event List where the Events are listed by Date (and dates in the future are also listed) and when the date is over they disappear from that list.
Is that possible with News Manager Addons?
Thanks for your help
Yes, it's possible. Precissely I intended to suggest this to you in the NM thread.

You can use functions nm_custom_list_future or nm_custom_display_future in your template or components.

If you need any further information or help let me know.
You made my day. Thank you so much!
I found an easier way to display only posts with a date in the future instead of filtering the other ones out (as with nm_custom_display_future). I edited line 25 in functions.php in /plugins/news-manager/inc/ and i just turned the < sign into the > sign.
With the method you suggested it displays only the first post that is in the future but with the method i just described it displays all future posts.

I have just one problem. With my method as it works now, the entries are in the wrong order. So, an entry with the date 2019-01-05 is at the top and an entry with the date 2018-12-28 is below it while it should be the other way round.
Can anyone help?
Don't know why you only get one post in the future.
Anyway, you can set the number of posts to be displayed.

An example:
- create a page Events
- write some future posts with tag 'events'
- in your template, insert this after <?php get_page_content(); ?> :
if (return_page_slug()=='events') {
    <h3><a href="{{post_link}}">{{post_title}}</a></h3>
    ', 'events');

(past events are here: )
Thanks, that works pretty fine.
Dear GS-friends,

thanks to some examples from Oleg I figured out how to display news in custom layout with php code directly.


<div class="posts">                
<?php nm_set_custom_image(160,160,1); ?>
<?php nm_set_custom_excerpt(200); ?>
<?php nm_set_custom_maxposts(8); ?>  
<?php nm_custom_display_random('  
<h4><a href="{{ post_link }}">{{ post_title }}</a></h4>
<p class="nm_post_date">{{ post_date }}</p>
<a href="{{ post_link }}">{{ post_image }}</a>
<div class="my_excerpt">{{ post_excerpt }}</div>
'); ?>

For a newer project I urgently need to output the "Tags" of the news entries, too.
(The goal is to add the "Tag" as a CSS-Class to the entries in order to enable a simple filtering function with javascript and CSS)

I tried {{ post_tag }} , but it didn't seem to work.

Is there any way to output the News-"Tags" with php?

Thanks for all your great coding and help!
I'll add support for that to the plugin.
Try this 0.9.6 beta version

You can use the {{ post_tags }} placeholder to display the post tags.
EXCELLENT!!!! Great thanks!!!!

A little complementary suggestion: Is it possible to wrap a "div" or "span" around the seperate tag-items?

(In order to style the items via CSS child-selector if needed, as coloured inline-blocks or whatever ...)

Best regards,
OK, the last quesion was silly - in order to use "tags" as CSS-class they have to be in lowercase sparated by " ", with nothing wrapped around it.

Nevertheless I tried a quick and dirty solution for the <span> output (line 220):
PHP Code:
     if ($showtags) {
       $tags strip_decode($post->tags);
       if (!empty($tags)) {
         if (function_exists('nm_lowercase_tags')) // NM 3.0+
               $tags nm_lowercase_tags($tags);
 $tags explode(","$tags);
 $tags "<span>".implode('</span><span>'$tags)."</span>";

$str str_replace('{{ post_tags }}', ($tags), $str);
     } ... 

By the way: Maybe there's an issue with "$tagseparator" (I assume this shall be included in (original) line 225)

I've set an individual separator in "News Manager Settings", this is visible in the standard news-manager output but not in the custom output.

Best regards!
(Replying to )

(2019-05-10, 02:23:50)smdp-1971 Wrote: If I do not select an image when creating new news - is there a way to set the default image, but only in the sidebar

I think I still haven't documented this...

You can use NM Addons' function nm_set_custom_image (with optional paramers for width, height, cropping and default image).

<?php nm_set_custom_image(200, 150, 1, 'image1.jpg'); ?>
(the default image is relative to data/uploads, but you can also specify a full url like http://...)

But if you just want to set the default image and not specify width, etc.:
<?php nm_set_custom_image(null, null, null, 'image2.jpg'); ?>

You have to insert that code before <?php nm_custom_display_recent ... ?>

Users browsing this thread: 1 Guest(s)