WordPress.org

Support

Support » How-To and Troubleshooting » Number of posts returned by query

Number of posts returned by query

  • I’m doing a filtered query:

    add_filter('posts_where', 'filter_where');
    	query_posts ($query_string . '&cat=457');

    filter_where is a time filter. As you can see, I’m pulling posts from a certain category during a certain timeframe.

    What I want is to know at this point whether any posts fit the query, whether it returned any hits. If it did, the posts will go in one place (in a magazine-like format); if it didn’t, they go to another. I figured that I’d be able to do a simple “if N >0 do this, if N=0 do that” — but I can’t figure out what function to use to get N.

    Thanks in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Number of posts returned by query’ is closed to new replies.
Skip to toolbar