WordPress.org

Ready to get started?Download WordPress

Forums

PREVIOUS and NEXT post links not working correctly in 2.0 (6 posts)

  1. stew278
    Member
    Posted 9 years ago #

    So I've got some problems with the next_posts_link and previous_posts_link actually going to the right entry on a web site - http://www.helengoesto.com/wp/

    The photos are entries in their own category, and I have used this line of code in the index.php file to block out other categories from displaying there:

    <?php c2c_get_random_posts($num_posts = 1,
    $format = "%post_content%",
    $categories = '2 3 4 6',
    $order = 'DESC',
    $date_format = '',
    $authors = '',
    $include_passworded_posts = false); ?>

    Then, where the written entry is (which is a different category), I have the usual tags for displaying content within the Loop. I am using the default tags for PREVIOUS and NEXT:

    <?php next_posts_link('&laquo; Previous Entries') ?>
    <?php previous_posts_link('Next Entries &raquo;') ?>

    ... but it doesn't work. Every time I click the "Previous Entry" link, the next page displayed is the same written content.

    Again, the temporary site is http://www.helengoesto.com/wp/ --- if you want to try testing out what I've attempted to describe here. I'm going to continue trying to work it out, but am in need of someone's help right now ...

    Thnx!

  2. stew278
    Member
    Posted 9 years ago #

    I've found the culprit in my code, but have no idea how to clean it up to make the page work ...

    <?php if (is_home()) { query_posts("cat=-5"); } ?> is what I'm using to have the page ignore category 5 (which is the parent directory for all photo categories that are listed above the photo - ie. "Grand Canyon"), where the entry (written word) would go. The photos are randomly generated.

    What do I need to do to make this work?

  3. groundchuck
    Member
    Posted 8 years ago #

    bump

    i'm having this problem too.

    anyone have any ideas?

  4. niziol
    Member
    Posted 8 years ago #

    If you're having the same problem, then the same solution should correct the problem, shouldn't it? If it doesn't correct it, then it obviously is not the same problem. If it's not the same problem, then you might want to post the details of your problem.

    Good luck,
    Michael.

  5. stew278
    Member
    Posted 8 years ago #

    I don't think it's clearly answered here, in fact, it really isn't, now is it?

    Here groundchuck ... answer to your problems.

  6. nutsmuggler
    Member
    Posted 8 years ago #

    BUMP.
    I have the same problem: the 'paged=' parameter does not work.
    This is my code; this snippet is embedded into a 'version' of home.php that displays only if (empty($_REQUEST['isarticles'])). In other words, I load this home to exclude posts from category 6.


    query_posts("cat=-6");
    if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>

    <div id="post-<?php the_ID(); ?>" class="post">
    <h2 class="post-title">" title="Permalink to <?php the_title(); ?>" rel="bookmark"><?php the_title(); ?></h2>
    <div class="post-entry">
    <?php the_excerpt('<span class="more-link">Continue Reading »</span>'); ?>
    <?php //link_pages('<p class="paged-link">Pages: ', '', 'number'); ?>
    </div><!-- END POST-ENTRY -->

    <!-- <?php trackback_rdf(); ?> -->
    </div><!-- END POST -->

    <?php endwhile; ?>
    prenav
    <div class="navigation">
    <div class="alignleft"><?php next_posts_link('« Earlier Posts') ?></div>
    <div class="alignright"><?php previous_posts_link('Later Posts »') ?></div>
    </div>
    postnav
    <?php else : ?>

    <div id="post-error" class="post">
    <h2 class="post-title"><span class="pre-title">404</span> Page Not Found</h2>
    <div class="post-entry">
    There's been a problem finding the page you're looking for. Apologies. Perhaps . . .

    • the page your looking for was moved;
    • your referring site gave you an incorrect address; or
    • something went terribly wrong.

    Use the search box and see if you can't find what you're looking for.
    </div><!-- END POST-ENTRY -->
    </div><!-- END POST -->

    <?php endif; ?>

    Is there anything in my code that prevents the 'paged' parameters from working? Or is it a wp bug?
    Thanks in advance,
    Davide

Topic Closed

This topic has been closed to new replies.

About this Topic