WordPress调用指定分类下的文章

<?php
$args=array(
'cat' => 1, // 分类ID
'posts_per_page' => 10, // 显示篇数
);
query_posts($args);
if(have_posts()) : while (have_posts()) : the_post();
?>
<div class="post">
<!-- Post Title -->
<h3 class="title"><a href="<?php the_permalink();?>" rel="bookmark"><?php the_title();?></a></h3>
<!-- Post Data -->
<p class="sub"><a href="#">News</a>, <a href="#">Products</a> • 31st Sep, 09 • <a href="#">1 Comment</a></p>
<div class="hr dotted clearfix"> </div>
<!-- Post Image 
<img class="thumb" alt="" src="images/610x150.gif" />-->
<!-- Post Content -->
<?php the_excerpt(); ?>
<!-- Read More Button -->

</div>
<div class="hr clearfix"> </div>
<?php endwhile; endif; wp_reset_query(); ?>

🏆 每日挑战:你知道答案吗?

在 JavaScript 中,如何避免全局变量污染?

温馨提示 : 非特殊注明,否则均为©李联华的博客网原创文章,本站文章未经授权禁止任何形式转载;IP地址:3.14.150.131,归属地:俄亥俄州Dublin ,欢迎您的访问!
文章链接:https://www.lilianhua.com/css-color-using-the-color-and-background-color-attributes-2.html

文澜千文文澜千文Beta

请登录以使用此功能。

Loading...