Thread Rating:
  • 2 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
News Manager Addons plugin
#76
Thank you Tim.

I think I'm going to "fix" this so that first is 1, as stated in the docs.
Reply
#77
(2015-07-02, 00:17:42)Carlos Wrote: I think I'm going to "fix" this so that first is 1, as stated in the docs.

Couldn't you just change the docs? Otherwise I will have to change my css.
It won't be backwardly compatible for anyone who has used it as it is.
Reply
#78
Agreed. Docs changed.
Thanks Tim.
Reply
#79
Here is the demo of the theme which came out of some work I was doing elsewhere:
http://timbowgs.bplaced.net/wordsworth/
The homepage with the post images and titles is simply and easily done with MNAddons. The main posts page (and individual posts) was just simply styled using the standard provided css classes. 

Really like this plugin. You can do a lot with it.
Reply
#80
Another small error in the docs on your cyberiada site:

You still have nm_set_custom_max_posts
should be nm_set_custom_maxposts without the underscore.

http://www.cyberiada.org/cnb/news-manage...ns-plugin/
Reply
#81
Thank you Tim. Corrected.
Reply
#82
I asked this question earlier in the New Manager forum, after doing a bunch more thinking and exploring I would like to reask here, in the correct place, and hopefully a little more intelligently, I think it is obvious I know zero about PHP, but . . .

I have created a posts index page using tags

This page is created with a function from this plugin:
<?php nm_list_recent_by_tag('obits-a', 999); ?>

At first, I believe the posts were listed by the date of publication, but in my application they really want to be alphabetized - http://boundary.idgenweb.org/obituary-index/

After reading a lot about sorting, and keys, and values, I tried this:

I have edited the function in on after line 50 - if (!empty($posts)) {
adding - SORT($posts);

This does seem to change the order of output, but it still isn't alphabetized, but I feel like I am on the right track, but it looks like that "explode" line might be adding keys?, like I said I know nothing about PHP.

Thank you for any help
Reply
#83
(Sorry for late response, a bit busy lately.)

Here's a modified version of nm_list_recent_by_tag, with posts sorted by title instead of recent date. You could add it to NM Addons, but I suggest you paste ir in your theme's functions.php file (create it if it doesn't exist).

Call it in your template or component with <?php nm_custom_list_alpha_by_tag('your-tag', 999); ?>

Code:
function nm_custom_list_alpha_by_tag($tag='', $max=0) {
  if (trim($tag) !== '') {
    if ($max <= 0) {
      global $NMRECENTPOSTS;
      $max = $NMRECENTPOSTS;
    }
    $allposts = nm_get_posts();
    $posts = array();
    foreach ($allposts as $post)
      if (in_array($tag, explode(',', $post->tags)))
        $posts[] = $post;
    unset($allposts);
    
    if (!function_exists('nm_comparePostTitles')) {
      function nm_comparePostTitles($a, $b) {
        if (function_exists('mb_strtolower'))
          return (mb_strtolower($a->title) < mb_strtolower($b->title)) ? -1 : 1;
        else
          return (strtolower($a->title) < strtolower($b->title)) ? -1 : 1;
      }
    }
    usort($posts, 'nm_comparePostTitles');
    
    $posts = array_slice($posts, 0, $max, true);
    if (!empty($posts)) {
      echo '<ul class="nm_recent">',PHP_EOL;
      foreach ($posts as $post) {
        $url = nm_get_url('post').$post->slug;
        $title = stripslashes($post->title);
        echo '<li><a href="'.$url.'">'.$title.'</a></li>',PHP_EOL;
      }
      echo '</ul>',PHP_EOL;
    }
  }
}
Reply
#84
(2016-07-12, 01:20:59)Carlos Wrote: (Sorry for late response, a bit busy lately.)

Here's a modified version of nm_list_recent_by_tag, with posts sorted by title instead of recent date. You could add it to NM Addons, but I suggest you paste ir in your theme's functions.php file (create it if it doesn't exist).

Call it in your template or component with <?php nm_custom_list_alpha_by_tag('your-tag', 999); ?>



Code:
function nm_custom_list_alpha_by_tag($tag='', $max=0) {
 if (trim($tag) !== '') {
   if ($max <= 0) {
     global $NMRECENTPOSTS;
     $max = $NMRECENTPOSTS;
   }
   $allposts = nm_get_posts();
   $posts = array();
   foreach ($allposts as $post)
     if (in_array($tag, explode(',', $post->tags)))
       $posts[] = $post;
   unset($allposts);
   
   function nm_comparePostTitles($a, $b) {
     if (function_exists('mb_strtolower'))
       return (mb_strtolower($a->title) < mb_strtolower($b->title)) ? -1 : 1;
     else
       return (strtolower($a->title) < strtolower($b->title)) ? -1 : 1;
   }
   usort($posts, 'nm_comparePostTitles');
   
   $posts = array_slice($posts, 0, $max, true);
   if (!empty($posts)) {
     echo '<ul class="nm_recent">',PHP_EOL;
     foreach ($posts as $post) {
       $url = nm_get_url('post').$post->slug;
       $title = stripslashes($post->title);
       echo '<li><a href="'.$url.'">'.$title.'</a></li>',PHP_EOL;
     }
     echo '</ul>',PHP_EOL;
   }
 }
}

Cool, we have been without internet for a week, I will try this on localhost.

Thank you very much Carlos
Reply
#85
(2016-07-12, 01:20:59)Carlos Wrote: (Sorry for late response, a bit busy lately.)

Here's a modified version of nm_list_recent_by_tag, with posts sorted by title instead of recent date. You could add it to NM Addons, but I suggest you paste ir in your theme's functions.php file (create it if it doesn't exist).

Call it in your template or component with <?php nm_custom_list_alpha_by_tag('your-tag', 999); ?>

Hi Again Carlos,

We finally got moved and have internet!

I tried your solution and it doesn't seem to be working, but maybe it is me. I set up a temp page to show the behavior.

http://boundary.idgenweb.org/obituaries/...y-index-1/

It makes it thru the loop for A and alphabatizes great but seems to hang on B.

This is the code I have in the component I am calling:

Code:
<div class="news-letters">
 <h4>Obituaries - surnames beginning with A</h4>
<?php nmclone1_custom_list_alpha_by_tag('obits-a', 999); ?>
</div>

<div class="news-letters">
 <h4>Obituaries - surnames beginning with B</h4>

<?php nmclone1_custom_list_alpha_by_tag('obits-b', 999); ?>
</div>

<div class="news-letters">
 <h4>Obituaries - surnames beginning with C</h4>

<?php nmclone1_custom_list_alpha_by_tag('obits-c', 999); ?>
</div>
<div class="news-letters">
 <h4>Obituaries - surnames beginning with D</h4>

<?php nmclone1_custom_list_alpha_by_tag('obits-d', 999); ?>
</div>

Am I missing something?
Reply
#86
I've edited my previous post, I made a slight change to the code. Should be fixed now.
Reply
#87
(2016-07-25, 05:32:07)Carlos Wrote: I've edited my previous post, I made a slight change to the code. Should be fixed now.

Awesome works great!

Thank you so much for your time!
Reply
#88
News Manager Addons version 0.9.4

- Added support for post title excerpts with new placeholder {{ post_title_excerpt }}

- New function nm_set_custom_title_excerpt lets you customize the title excerpt length (default 15) and ellipsis (default "..."), example:
Code:
<?php nm_set_custom_title_excerpt(30, " ..."); ?>

Also:
- Fixed: breakWords custom setting was ignored in post excerpts
Reply
#89
Hi Carlos,

do you have any idea/hint how to create an Archive with months visible for current year and years only for previous ? Currently I can only use month list or year list. First is not very handy because there is 1 post every month, so too many links, but for years it would show only 3 links, so that's just too restricted, so combination would be the way
Reply
#90
I intend to do something like that but slightly different, probably with months grouped by year, and dropdowns (more or less like in Blogger blogs).

For now I suggest you remove the list from the sidebar and place the full archive list in a separate page - see here:
http://get-simple.info/forums/showthread...8#pid44468
Reply
#91
News Manager Addons version 0.9.5

New functions nm_custom_display_random and nm_custom_list_random to display randomly selected posts (instead of recent or future ones) (@rokkybalbboa)
Reply
#92
hey, guys, the external images messes up all the other images on my website, it has its own size coming from the outside of my website, does anyone know how to fix it? I would really appreciate. Tks
Reply
#93
You cannot resize external images so perhaps you can use CSS (max-width, max-height) or some reponsive class if you use a framework like bootstrap, etc.
Reply
#94
(2018-03-02, 05:02:59)Carlos Wrote: You cannot resize external images so perhaps you can use CSS (max-width, max-height) or some reponsive class if you use a framework like bootstrap, etc.

Thank you, Carlos. You are a very helpful person.
Reply
#95
Dear Carlos,

I went through all the documentation and the threads but I could not find an answer for a quite simple question... maybe it is just clear for everybody?

Below the single-post I would like to show a short list like "More of my posts", and this works fine with nm_custom_display_recent. But how can I exclude the active single-post from this list? It is not necessary that it shows up again and confuses the reader.

Here is an example: http://ihrassistent.com/blog/post/silbentrennung

Thank you very much for your help!!

Smile
Reply
#96
Currently there's no way to exclude a specific post, but it can hidden with css.
However, in your example, only 2 posts would be visible instead of 3.
(Let me know if you're interested in this solution and I'll explain later)
Reply
#97
Good evening to all.

When I create a new post in my website the new post contain a title, the date creation, the text and the tags.

Is there a way to hide date creation and tags? 

The important thing is the title and the text.

Thanks in advance.

Luke
Reply
#98
I'll reply in the proper support thread -> http://get-simple.info/forums/showthread...9#pid63139
Reply
#99
(2018-09-30, 02:01:41)Carlos Wrote: Currently there's no way to exclude a specific post, but it can hidden with css.
However, in your example, only 2 posts would be visible instead of 3.
(Let me know if you're interested in this solution and I'll explain later)

My idea is that there are always at least 3 post visible but it does not matter if there are more. I wrote two "Test"-posts and they would just open up a new line, no problem. And with a maxpost I could keep it under control.

I just do not know how to put a "style="display:none" to the active post, it would be something like "if post is active then...".

Thanks for your support, it's really great!!
Reply
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 } ?>
Reply




Users browsing this thread: 1 Guest(s)