WordPress.org

Ready to get started?Download WordPress

Forums

"Previous" and "Next" on Custom Page Showing Same Posts (3 posts)

  1. ElPatre
    Member
    Posted 5 years ago #

    Hello,

    i have created a new page (http://www.angryangmo.com/?page_id=211) in my blog, which i simply copied the logic for getting posts from the index.php.

    Code:

    <?php if (have_posts()) : ?>

    <?php while (have_posts()) : the_post(); ?>

    <div class="post" id="post-<?php the_ID(); ?>">
    <h2>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></h2>
    <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>

    <div class="entry">
    <?php the_content('Read the rest of this entry »'); ?>
    </div>

    <p class="postmetadata"><?php the_tags('Tags: ', ', ', '
    '); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
    </div>

    <?php endwhile; ?>

    <div class="navigation">

    <div class="alignleft"><?php next_posts_link('« Older Entries') ?></div>

    <div class="alignright"><?php previous_posts_link('Newer Entries »') ?></div>

    </div>

    However the navigation links previous and next are not working on this page, resp always showing the same posts although the links of next and previous are "&paged=2" .. "&paged=3" etc.

    The complete link looks like this "http://www.angryangmo.com/?page_id=211&paged=3".

    Ive already tried all kind of different options and new codes but i always end up getting the same posts. Can somebody more experienced please help me?

    Cheers
    Flo

  2. moshu
    Member
    Posted 5 years ago #

    Never double post! It gets deleted.

    WP knows that you are on a Page. Pages are NOT meant to display multiple entries, they were created to display one single entry (i.e. the Page's content). So, WP is refusing to execute your navigation (next/prev) code because it knows better than your: this is a Page and no need for navigation. It is that simple.

    On another note: instead of asking technical question that even you don't understand... just describe WHAT are you trying to do. Plain English, nothing technical, just tell what do you want to achieve.
    Others will tell you HOW to do it.

  3. jikoyster
    Member
    Posted 5 years ago #

    simply place your navigation inside the loop - before endwhile.

Topic Closed

This topic has been closed to new replies.

About this Topic