posts_per_page => 1 shows 2 posts

Most probably you have a sticky post there. If you want exact number of posts you need to ignore sticky posts. So your query should look like this: query_posts( array( ‘orderby’ => ‘rand’, ‘posts_per_page’ => 1, ‘ignore_sticky_posts’ => 1, ) ); or as suggested, never use query_posts() $query = new WP_Query( array( ‘orderby’ => ‘rand’, … Read more

Query posts without a specific ID

Most of the things you can do with a query are described in the Codex page for WP_Query You need to use the ‘post__not_in’ parameter eg: $args = array( ‘post__not_in’ => array(’34’,’54’), // post ids ‘post_type’ => ‘page’ );`

Different number of posts on the front page

There is a post_limits hook that you can use for this purpose exactly: // in homepage show 6 posts add_filter(‘post_limits’, ‘homepage_limits’ ); function homepage_limits( $limits ) { if(is_home() ) { return ‘LIMIT 0, 6’;; } return $limits; }

How to show only today’s post?

This should do the trick: <?php $day = date(‘Ymd’); query_posts(“m=$day”); The query arg ‘m’ for WordPress will be interpreted as a year if it is four characters long, a month if 6, and a date if 8. EDIT You should probably add in the original query string just in case you’re writing enough to need … Read more