wordpress調用指定分類文章,搭建網站
導讀:搭建網站搭建網站
- <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 the_permalink(); ?>"><?php the_title(); ?></a> //標題
- <span>
- <?php if (has_excerpt()) {
- echo $description = get_the_excerpt(); //文章編輯中的摘要
- }else {&n織夢的模板bsp;
- echo mb_strimwidth(strip_tags(apply_filters('the_content', $post->post_content)), 0, 170,"……"); //文章編輯中若無摘要,自定截取文章內容字數做為摘要
- } ?>
- </span>
- </li>
- <?php endwhile; endif; wp_reset_query(); ?>
- </ul> 相關信息技術網站網站開發技術。
聲明: 本文由我的SEOUC技術文章主頁發布于:2023-07-23 ,文章wordpress調用指定分類文章,搭建網站主要講述文章,div,wordpress網站建設源碼以及服務器配置搭建相關技術文章。轉載請保留鏈接: http://www.bifwcx.com/article/web_34921.html