Wordpress列表类别链接

时间:2011-07-19 19:54:36

标签: php loops wordpress

我有这段代码

<?php wp_list_categories('include=3,5,4&orderby=id&title_li='); ?>
        <li <?php if (is_home()) { echo " class=\"active\"";}?>><a
            href="<?php bloginfo('url');?>">All Posts</a></li>
    </ul>
</div>
<div id="bottom">
    <div id="topHead">
    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
            $exclude = get_option('ss_blogexclude');
            query_posts('cat=-8,-9,-10' . $exclude .'&paged=' . $paged);
    ?>

        <div class="post">
            <!-- Start the Loop. -->
        <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

当我点击某个类别时,什么不起作用,它没有显示该类别的帖子,但它仍然显示所有....

1 个答案:

答案 0 :(得分:0)

将代码更改为:

<?php if(is_home()) { 
        query_posts( array(
            'showposts' => get_option('posts_per_page'),
            'paged' => get_query_var('paged'),
            'cat' => '-8,-9,-10')
        );
    }?>