Recent Posts Widget Extended
New option - Hide Widget if there are no results (3 posts)

  1. davgarcia
    Posted 2 years ago #

    It would be great if there were an option to hide the widget if there are no results that satisfy the criteria. Currently the widget title still shows up all by its lonesome.


  2. Satrya
    Posted 2 years ago #

    I'm sorry I dont understand with the 'no results'. When you found the no results criteria?

  3. davgarcia
    Posted 2 years ago #

    Right, so on the site I have the widget in the sidebar for all pages. And I modify the query using rpwe_default_query_arguments so that it only shows related blog posts that reference the page's topic. So if $post->ID == 2 then I add something like $args["category__and"] = array(5, 6);.

    On a few pages this very restrictive filter returns no results at all, displaying the widget title bar and nothing else. So what I did was modify the plugin code so that it runs the query first and then displays the title and results, but only if the query returned more than 0 results.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic


No tags yet.