WordPress 技巧:调用置顶文章
有些时候我们需要调用 WordPress 置顶文章并单独显示出来,可以通过 WP_Query 来实现,代码如下:
-1,
'post__in' => get_option( 'sticky_posts' )
);
$sticky_posts = new WP_Query( $args );
while ( $sticky_posts->have_posts() ) : $sticky_posts->the_post();?>
<li>
<a href="" rel="bookmark" title="Permanent Link to "></a>
</li>
©我爱水煮鱼,本站推荐使用的主机:阿里云,国外主机建议使用BlueHost。
本站长期承接 WordPress 优化和建站业务,请联系微信:「chenduopapa」。