wordpress调用置顶文章

wordpress yekong 444℃

调用5篇置顶文章


<?php
$args = array(
    'posts_per_page' => 5,
    'post__in'  => get_option( 'sticky_posts' )
);
$sticky_posts = new WP_Query( $args );
while ( $sticky_posts->have_posts() ) : $sticky_posts->the_post();?>

<li>
    <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>
</li>
<?php endwhile; wp_reset_query();?>
喜欢 (0)