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:
Code:
<li style=...>
to:
Code:
<li id="nma_post_{{post_slug}}" style=...>

- Insert this in the <head> section of your template:
Code:
<?php if (nm_is_single()) { ?>
<style>
#nma_post_<?php nm_post_slug(); ?> { display:none; }
</style>
<?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...

Smile
Reply
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
Scorpio
Reply
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.
Reply
You made my day. Thank you so much!
Reply
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?
Reply
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(); ?> :
Code:
<?php
if (return_page_slug()=='events') {
  nm_set_custom_maxposts(9999);
  nm_custom_display_future('
    <h3><a href="{{post_link}}">{{post_title}}</a></h3>
    <p>{{post_date}}</p>
    {{post_content}}
    ', 'events');
}
?>
demo: http://webs.org.es/newsmanagerdemo/events/

(past events are here: http://webs.org.es/newsmanagerdemo/news/tag/events )
Reply
Thanks, that works pretty fine.
Reply
Dear GS-friends,

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

Example:

Code:
<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('  
<article>
<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>
</article>
'); ?>
   </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!
Reply
I'll add support for that to the plugin.
Reply
Try this 0.9.6 beta version
http://www.cyberiada.org/cnb/data/upload...6-beta.zip

You can use the {{ post_tags }} placeholder to display the post tags.
Reply
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,
Holger
Reply
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!
Reply




Users browsing this thread: 2 Guest(s)