wordpress调用指定分类置顶文章

Black wordpress 28 次浏览 wordpress调用指定分类置顶文章已关闭评论
<ul class="rowNewsUl">
                <?php
                    $args = array(
                    'post_type' => 'post',
                    'showposts' => 3,
                    //'orderby' => 'rand',
                    'post__in' => get_option('sticky_posts'),//获取置顶文章
                    'cat' => array(8),//指定分类id
                    );
                ?>
				<?php
					$catquery = new WP_Query($args);
					while($catquery->have_posts()) : $catquery->the_post();
					
				?>
				<li class="rowNewsLi"><h4><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h4></li><?php //the_content(); ?>
				<?php endwhile; ?>
			</ul>
Go