My custom query shows only 2 post, My post_ids in the array are correct and I've changed the number of $posts_per_page several times but still no luck.
(我的自定义查询仅显示2个帖子,数组中的post_ids是正确的,并且我多次更改了$ posts_per_page的数量,但还是没有运气。)
Any Suggestion will be helpful. (任何建议都会有所帮助。)
Thanks in advance. (提前致谢。)
<?php
$paged = get_query_var("paged") ? get_query_var("paged") : 1;
$posts_per_page = 5;
$post_ids = array( 156, 151, 154, 157, 1, 15);
$custom_q = new WP_Query (array(
'post__in' => $post_ids,
'orderby' => 'post__in',
'paged' => $paged
));
while($custom_q->have_posts()){
$custom_q->the_post();
?>
<h2><a href="<?php the_permalink();?>"><?php the_title();?></a></h2>
<?php
}
wp_reset_query();
?>
ask by Ami Hasan translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…