Wordpress problem while retrieving certain posts by their number?
I asked a question before about the same question here : Retrieve certain posts by their number?
every thing was going fine and I called 4 posts, but the problem appeared suddenly and only 3 are appearing now !
here is the code I use
<?php $recent = new WP_Query( array( 'post__in' => array( 264, 137, 145 , 88 ) ) ); while($recent->have_posts()) : $recent->the_post();?>
">
what is wrong with my code ?? I开发者_JAVA技巧'm sure these post numbers are correct and I tried many many of them and all have the same effect
To get a different number of posts from the 'Blog pages show at most' setting just add a posts_per_page
parameter to your query. In the case where you are also using post__in
you probably want to set this to -1
so all the posts are returned.
new WP_Query(array(
'post__in' => array(264, 137, 145 , 88),
'posts_per_page' => -1
));
精彩评论