A5下载 - 努力做内容最丰富最安全的下载站!

A5站长下载站

当前位置:A5下载 > 源码技巧 > wordpress > WordPress置顶文章的调用方法

WordPress置顶文章的调用方法

时间:2015-09-07 13:43作者:fang人气:48

<?php

$sticky = get_option('sticky_posts');

rsort( $sticky );

$sticky = array_slice( $sticky, 0, 5);

query_posts( array( 'post__in' => $sticky, 'caller_get_posts' => 1 ) );

if (have_posts()) :

while (have_posts()) : the_post();

?>

<li><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" rel="bookmark"><?php the_title(); ?></a></li>

<?php endwhile; endif; ?>

标签WordPress,置顶,文章,调用,方法,php,stic

相关下载

查看所有评论+

网友评论

网友
您的评论需要经过审核才能显示

热门阅览

最新排行

公众号