$args:是要显示的分类的参数。query_posts():可以用来控制在循坏(Loop)中显示哪些文章。下面的添加循环和条件判断,还有标题,内容的k">输出 大家应该知道了。<ul> <?php $args=array( 'cat' => 1, // 分类ID 'posts_per_page' =…

$args:是要显示的分类的参数。

query_posts():可以用来控制在循坏(Loop)中显示哪些文章。

下面的添加循环和条件判断,还有标题,内容的输出 大家应该知道了。

<ul>  <?php      $args=array(          'cat' => 1,   // 分类ID          'posts_per_page' => 10, // 显示篇数      );      query_posts($args);      if(have_posts()) : while (have_posts()) : the_post();  ?>      <li>          <a href="<?php%20the_permalink();%20?>"><?php the_title(); ?></a> //标题          <span>          <?php if (has_excerpt()) {                  echo $description = get_the_excerpt(); //文章编辑中的摘要              }else {                  echo mb_strimwidth(strip_tags(apply_filters('the_content', $post->post_content)), 0, 170,"……"); //文章编辑中若无摘要,自定截取文章内容字数做为摘要              } ?>          </span>      </li>  <?php  endwhile; endif; wp_reset_query(); ?>  </ul>  
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。