WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] query_posts breaking next & previous page links navigation (1 post)

  1. kylegach
    Member
    Posted 6 years ago #

    A moderator can delete this please. Sorry for the trouble.

    I was uploading my revised index.php to the wrong theme folder the whole time. Silly me.

    Here is my site:

    http://ksuchallenge.com/fresh

    I'm using query_posts to exclude some categories from the front page and it seems to have broken the pagination built into WordPress. I've read (and implemented) each of the solutions listed here:

    http://wordpress.org/support/topic/57912#post-312858
    http://wordpress.org/support/topic/152451?replies=12#post-679318
    http://www.michaelciccarelli.com/2008/07/fix-pagination-on-query-posts/

    with no luck.

    Here are the two blocks of code I've tried:

    Method 1

    <?php
    $limit = get_option('posts_per_page');
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts('showposts=' . $limit . '&paged=' . $paged .'&cat=-6,-8,-9,-10');
    $wp_query->is_archive = true; $wp_query->is_home = false;
    ?>
    
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    Method 2

    <?php if (have_posts()) : $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("cat=-6,-8,-9,-10&paged=$paged"); while (have_posts()) : the_post(); ?>

    Neither one works, and I'm quite stumped and would appreciate any help. Please let me know if you need any more information.

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic