Forums

[resolved] Page 2 and Home display same posts (3 posts)

  1. Storyman
    Member
    Posted 4 years ago #

    The 'posts_nav_link' appears to be working, but when page 2 appears (www.site.com/page/2) it displays the same posts as the Home page does.

    The site is: DisabilityHappens.com

    Don't know if I'm going in the right direction, but it would seem that it is loosing the ID number last displayed and starting over.

    Any suggestions?

  2. Storyman
    Member
    Posted 4 years ago #

    Found the problem, but have no idea on the cure.

    This line of code appears at the top of the page:

    <?php query_posts("cat=-71"); ?>

    When remarked out the Next/Previous works as advertised.

    When the code is functional the Next/Previous will always display the same posts that are on the Home page.

    Is there a fix?

  3. Storyman
    Member
    Posted 4 years ago #

    After contacting one jcornide, who had posted the same problem and received no replies, he was kind enough to email what solution he did find.

    After contacting jcornide, I found the solution that he used to solve the problem. This is what he wrote:

    Yes, I solved the problem with the page 2. Maybe you are excluding one category in the home of your blog? If yes, you maybe be using something like:
    query_posts( "cat=-3");

    Well, I changed that for this:
    query_posts( $query_string . "&cat=-3");

    And now works :)

    Hope this will help.

    The solution I contrieved was a If-Else:

    <?php if (!in_category('3')) : ?>
    posting code here
    <?php else : ?>
    <?php endif; ?>

    [This code was used on index.php and page.php]

    Of the two, I feel jcornide's solution is far better than mine--less is more in my book.

Topic Closed

This topic has been closed to new replies.

About this Topic