置顶文章是WordPress建网站常用的文章提升重要性的方法。Wordpress设置置顶文章也比较简单,在网站后台就可以设置文章置顶。但有些对于WORDPRESS程序不了解的新手仍然不知道怎么设置置顶文章,下面介绍一下WordPress如何设置置顶文章的方法。
步骤如下:
第一步:进入网站管理后台。点击左侧菜单的文章---所有文章,就可以看到自己网站的所有发布的文章;
<?php $query_post = array(
'posts_per_page' => 5,
'post__in' => get_option('sticky_posts'),
'caller_get_posts' => 1
);
query_posts($query_post);
?>
<?php while(have_posts()):the_post(); ?>
<li class="li1"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li>
<?php endwhile; ?>
<?php wp_reset_query();?>