Tagged: 

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #7532
    demis
    Participant

    Hello,

    Thank you for your very useful, free plugin!

    I’ve made a page template that is meant to insert the news list into part of the page (on the right-column).

    I intended to use nm_display_news(), as you suggested in another answer, but it is returning the ‘No News” message. I also tried setting the arguments directly as so:

    $newsargs = array(
    ‘number_of_news’ => 5,
    ‘tags’ => ‘all’,
    ‘categories’ => ‘all’,
    ‘order_by’ => ‘publish’,
    ‘order’ => ‘ASC’,
    ‘show_news_thumbnail’ => FALSE,
    ‘show_news_excerpt’ => FALSE,
    ‘news_thumbnail_size’ => ‘thumbnail’,
    ‘no_news_message’ => __(‘REALLY No News found.’, ‘news-manager’)
    );
    echo nm_display_news($newsargs);

    It then displays “REALLY No News found.” – it’s taking the arguments but not returning any news. My website.org/news page does show 4 news articles (no News cat/tags used).
    Any idea what I’m doing wrong?

    Thanks!

    #7533
    demis
    Participant

    Minor update: Using nm_display_news_archive() will show a list of four months, so it does pick up that there are news articles present. Unfortunately only nm_display_news() doesn’t find them or is filtering them out somehow.

    #7534
    demis
    Participant

    I figured it out – I think this is a minor bug in your plugin.
    Your default args to nm_display_news() include

    'tags' => 'all',
    'categories' => 'all',

    But the function tests for !empty(args['tags']) to determine whether to include tax_query in the WP_Query() call, and the ‘tags’ argument can never empty since the default argument is 'all'.
    I changed the defaults in functions.php (line 228, 229) to be

    'tags' => array(),
    'categories' => array(),

    so !empty() can be False if I didn’t pass anything and then the tax_query argument is Not passed to WP_Query – finally allowing ALL News articles to be listed!

    #7548
    Bartosz
    Keymaster

    Yeah, looks like a bug.

    Thx @demis, it will be corrected with the new version.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.