[英]wp_query not working
我决定开始在首页上使用wp_query
而不是query_posts
,我想从div中的特定页面调用内容。 我只是想知道我在这里缺少什么,因为什么也没出现,所以我确实有一个页面的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>
您已经使用在WP_Query错误的说法,应该page_id
而非paged
。 这是食典的参考;
http://codex.wordpress.org/Class_Reference/WP_Query#Post_.26_Page_Parameters
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.