0

我决定在我的主页上开始使用wp_query而不是, 我想从 div 中的特定页面调用内容。query_posts只是想知道我在这里遗漏了什么,因为什么都没有出现,而且我确实有一个 ID 为 140 的页面。我对此还是很陌生,谢谢!

<div class="home-info" > 
<?php 
if (have_posts() ) :

$the_query = new WP_Query( 'paged=140' );
while ($the_query->have_posts() ) : $the_query->the_post();
echo the_content();
endwhile;
wp_reset_postdata();

endif; 
?> 
</div>
4

1 回答 1

1

您在 WP_Query 中使用了错误的参数,它应该是page_id而不是paged. 这是 Codex 的参考资料;

http://codex.wordpress.org/Class_Reference/WP_Query#Post_.26_Page_Parameters

于 2012-10-16T09:16:10.633 回答