WP查询发布分页;不起作用


WP query posts pagination doesn't work

在将query_posts代码添加到我的WP模板index.php文件后,我的分页不再工作。我确实使用了搜索并尝试了一些方法,但似乎什么都不适合我。

我所做的只是在这个代码中添加<?php if ( is_home() ) {query_posts( 'cat=-85' );}?>行:

<?php get_header(); ?>
    <div id="primary" class="content-area clr">
        <div id="content" class="site-content" role="main">
            <div class="container clr">
                <div id="post" class="col col-1 span_3_of_4 clr">
                    <?php if ( is_home() ) {query_posts( 'cat=-85' );}?>
                    <?php while ( have_posts() ) : the_post(); ?>
                        <?php get_template_part( 'content', get_post_format() ); ?>
                    <?php endwhile; ?>
                    <?php wpex_pagination(); ?>
                </div><!-- #post -->     
                <?php get_sidebar(); ?>
            </div><!-- #post -->
        </div><!-- #content -->
    </div><!-- #primary -->
<?php get_footer(); ?>

你能帮我吗?

我找到了解决方案:

<?php if ( is_home() ) {
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts($query_string . '&cat=-85&paged='.$paged);
} ?>