我想从显示我的博客文章中排除类别。我的类别 id 是62。类别名称是perfect_work
这是我的 wordpress 博客模板代码:
    <div id="left" class="eleven columns">
    <?php
    $temp = $wp_query;
    $wp_query= null;
    $wp_query = new WP_Query();
    $wp_query->query('paged='.$paged);
    ?>
    <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
        <div class="post" id="post-<?php the_ID(); ?>">
            <div class="title">
                <h2><a href="<?php the_permalink() ?>" title="Permanent Link to <?php the_title(); ?>" ><?php the_title(); ?></a></h2>
                <div class="postmeta">  <span>by <?php the_author_posts_link(); ?></span> | <span><?php the_time('l, F jS, Y') ?></span> | <span><?php the_category(', '); ?></span> </div>
            </div>
            <div class="entry">
            <?php $image_attr = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'top_feature'); ?>    
                <a href="<?php the_permalink() ?>"><img src="<?php echo $image_attr[0]; ?>" class="postim scale-with-grid" id="blog-thumb" ></a>
                <?php wpe_excerpt('wpe_excerptlength_archive', ''); ?>
                <div class="clear"></div>
            </div>
        </div>
    <?php endwhile; ?>
    <?php getpagenavi(); ?>
    <?php $wp_query = null; $wp_query = $temp;?>
</div>
我已经尝试过使用
$wp_query = new WP_Query('cat=-62');
它不起作用。我也放
<?php query_posts('cat=-62'); ?>
<?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
它的工作,但页面导航不起作用,也没有显示其他人的帖子。仅第 1 次 5 后显示。
任何解决方案?