创业大学
您当前位置 :首页 > 创业大学 >
"; if($cat_id == 31){ echo "
"; } // 获取该分类下的第一篇文章 $args = array( 'cat' => $cat_id, // 分类ID 'posts_per_page' => 1, // 每页显示的文章数量 'orderby' => 'date', // 按日期排序 'order' => 'ASC', // 升序 ); $cur_post = get_posts($args); if ($cur_post) { $content = $cur_post[0]->post_content; // 文章内容 echo $content; } else { echo '文章不存在'; } echo "
"; // 释放查询结果 wp_reset_postdata(); } // 假设你已经在WordPress环境中,并且有分类ID $category_id $category_id = $cat_id; // 替换为你的分类ID // 获取分页参数 $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; // 查询参数 $args = array( 'cat' => $category_id, // 分类ID 'posts_per_page' => 12, // 每页显示的文章数量 'paged' => $paged ); // 查询文章 $query = new WP_Query($args); if ($query->have_posts()) { if($cat_id == 32){ echo '
    '; } if($cat_id == 35){ echo '
      '; } if($cat_id == 36){ echo '
        '; } while ($query->have_posts()) { $query->the_post(); // 在这里编写你的文章列表 $post_id = get_the_ID(); // 获取文章ID $post_slug = get_post_field( 'post_name', $post_id ); // 获取文章别名 $excerpt = get_the_excerpt(); // 获取摘要 // 师资力量 if($cat_id == 32){ ?>
      • >>

      '; // 分页导航 lingfeng_pagenavi(); } else { // 没有找到文章的提示 echo '没有找到文章。'; } // 重置WordPress查询 wp_reset_postdata(); ?>