WordPress.org

Support

Support » Plugins and Hacks » New option – Hide Widget if there are no results

New option – Hide Widget if there are no results

Viewing 2 replies - 1 through 2 (of 2 total)
  • Satrya
    Participant

    @satrya

    Hi,
    I’m sorry I dont understand with the ‘no results’. When you found the no results criteria?

    davgarcia
    Member

    @davgarcia

    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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘New option – Hide Widget if there are no results’ is closed to new replies.