Support » Fixing WordPress » Page 2, 3, 4, etc Display Content of Main Page. HELP!

  • Resolved Tranny


    I don’t know which part I had messed up, but when I click on “Previous Page” which takes me to Page 2 of the list of entries, I only see the same entries as on main page displayed.

    The URL changes and contains …page/2/ at the end, Title tag changes as well and contains – Part 2 – behind the title. The only catch is that the same posts that appear on the main page are displayed. It does not display older posts. Anyone know what it is I have messed up that content of each older page displays the same, latest posts?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Did you by any chance put a query_posts() on that page?

    I may have, I’ve done some modifications to the theme in order to exclude some categories from displaying on certain pages. I did my own search for solution and followed instructions I have found. Obviously I messed something up big time 🙁

    What should I be looking for as the cause of the issue?

    I was helping someone with the identical symptoms the other day and found a solution.

    Find your query_posts statement – from what you describe sounds like it would be in your theme’s index.php

    Put this line of code before the query_posts statement

    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>
    Now you must modify your query_posts line.
    If it looks like this as example
        query_posts("cat=1"); ?>

    paste this &paged=$paged in so it now looks like this

    query_posts("cat=1&paged=$paged"); ?>`

    Whatever the query_posts line is, paste &paged=$paged just before the closing quote or apostrophe. This tells WP to page the posts it has selected in the way you want it to.

    I’ve tried it, for some reason it hasn’t worked. However you are obviously pointing me the right direction. This is the statement I have included in the index.php file:

    <?php query_posts('cat=-1,-91'); ?>

    It did the job I wanted form it – it excluded two categories from displaying in results. However the downside it was that older pages displayed the same content as first page. I have modified the code into your suggested statement so the final render looks like this:

    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>
    <?php query_posts('cat=-1,-91&paged=$paged'); ?>

    For whatever reason it has not solved the problem and all older pages still display the same posts as the main page. The issue is definitely there, because after I’ve removed that while statement, old pages display older posts as per correct order. But now it also displays posts in categories I don’t want.

    Any idea what is wrong with that statement still that it doesn’t work?

    Sorry, one thing I forgot…
    change this
    <?php query_posts('cat=-1,-91&paged=$paged'); ?>
    to this
    <?php query_posts("cat=-1,-91&paged=$paged"); ?>

    Doesn’t look like much difference but it means something very different to PHP

    Now it works. Thank you so much for your help, Steve :o)

    That did the trick for me, too once I change it to “.



Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Page 2, 3, 4, etc Display Content of Main Page. HELP!’ is closed to new replies.