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




Users browsing this thread: 1 Guest(s)