I’m using query_posts on my home page to fetch articles from multiple post types. I’m using following code to do so.
<?php query_posts( array('post_type' => array('post','page','custom_post1','custom_post2','custom_post3','custom_post4','custom_post5','custom_post6')));
if (have_posts()) : while (have_posts()) : the_post(); // begin the Loop ?>
/*html code goes here*/
<?php endwhile; endif; ?>
It fetches the posts rightly, but the problem is: it does not fetch old posts. So for example I have 1 post and its publish date is 02/july/2012, this post won’t be displayed on my home page. But as soon as I update the date to 02/Aug/2012 it starts showing up on Home page.
So is there any code I can add in query_posts that will enable older posts to be fetched too.
WordPress by default fetch 10 posts or number of posts set by user from admin.
query_posts accept argument that return number of record.