0
目前,我有一个页面,显示来自所有类别(3类)的帖子。现在,我正在尝试制作类似的页面,但我不想显示其中的某个类别。WordPress的 - 从显示所有类别显示具体
我知道我需要它从显示全部显示ID为10,11,15的类别。
这是我目前正在工作的PHP脚本,显示所有。
<div class="clearFloat">
<div id="container">
<div id="content" role="main">
<?php
// get all the categories from the database
$cats = get_categories();
// loop through the categries
foreach ($cats as $cat) :
// setup the cateogory ID
$cat_id= $cat->term_id;
// Make a header for the cateogry
?>
<div class='category-container clearFloat'>
<h2><?php echo $cat->name; ?></h2>
<?php
// create a custom wordpress query
query_posts("cat=$cat_id&posts_per_page=100");
// start the wordpress loop!
if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php // create our link now that the post is setup ?>
<div class="course">
<a href="<?php echo get_the_permalink(); ?>">
<h3 class="course-title"><?php the_title(); ?></h3>
</a>
<div class="promo"></div>
<div class="course-content">
<?php the_excerpt(); ?>
</div>
<div class="fadeUp"></div>
<a class="more-link" href="<?php echo get_the_permalink(); ?>">Find out more</a>
</div>
<?php endwhile; endif; // done our wordpress loop. Will start again for each category ?>
</div>
<?php endforeach; wp_reset_query();// done the foreach statement ?>
</div><!-- #content -->
</div><!-- #container -->
非常快tzafar :) –