• Ive searched around for an answer to this and saw a couple of the same posts around with the same problem, but no actual answer unfortunately.

    Problem being I have 3 seperare categories being displayed on 1 page… I would like to make it so that the Main category of the page can be scrolled through to older posts with pagination.

    I put the code in after <?php endwhile ?>, the pagination displayed, and the links worked, however the posts on the page remained the same and didnt change regardless of which page I went to.

    After reading some older posts I have probably used ‘query_posts’ wrong, so hopefully somebody here can help.

    Im using Query_Posts 3 times like so:

    <?php
    query_posts('category_name=news');
    while ( have_posts() ) : the_post() ?>
    
      // styling here //
    
    <?php endwhile ?>

    Then that is simply repeated on the page with a different category_name.

    Link to site: https://www.thefightlounge.co.uk

    Thanks,

Viewing 4 replies - 16 through 19 (of 19 total)
  • Thread Starter mikedistras

    (@mikedistras)

    Oh, no idea why there is double nav in there either, got rid of that anyway now…

    Added the endwhile and endif statements to the other query’s on the page, and added wp_reset_query too.

    Also done the first loop as you mentioned however its still doing the same as before… The nav links are displaying, however no content changes.

    Current layout:
    https://wordpress.pastebin.com/jkrkfsx2

    Thread Starter mikedistras

    (@mikedistras)

    Any other ideas anybody??

    Thread Starter mikedistras

    (@mikedistras)

    This is absolutely winding me up now, haha. having read so many different posts and way to achieve this, yet nothing has really worked.

    This is the link to the page:
    https://www.thefightlounge.co.uk

    I want the “news”/Main section to have the Pagination(next/prev) links that actually work. I dont need the other 2 categories on the right hand side to have pagination on them, just the main news category.

    This is a link to the current code for the page: https://wordpress.pastebin.com/HfM17uXD

    Any help and edits welcome and very appreciated!

    Just posting to say esmi’s solution fixed my pagination issue.

    My simpler query was like this:
    <?php query_posts($query_string . '&cat=-9'); ?>

    and pagination was broken.

    I made some slight mods as I was excluding a category from my normal loop:

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $args= array(
    	'cat' => -9,
    	'paged' => $paged
    );
    query_posts($args);
    ?>

    Note my cat arg excludes category ID 9.

Viewing 4 replies - 16 through 19 (of 19 total)
  • The topic ‘Query posts and Pagination Links Broken’ is closed to new replies.