WordPress提供了多种方法查询文章,WP_Query是最灵活的查询文章方法,下面是使用方法介绍。 $args = array( 'post_type' => 'post', // 文章类型(默认post) 'posts_per_page' => 5, // 显示数量 'orderb
WordPress怎么获取置顶状态的文章?差点忘了,下面记录下。 查询文章方法有很多,这里使用WP_Query,然后其实主要用到get_option('sticky_posts')。 $args = array( 'post__in' => get_option('sticky_posts')