Support » Fixing WordPress » Next/Previous Links not working

  • Hello, Hopefully someone can help me here.

    The problem is my Next/Previous Links are not working. When I click on the link it shows the article I already have. I have spent time looking at similar topic problems but I can’t seem to find any solution to fix my page.

    http://www.jessegunzel.com/blog

    I think it may be because I start out with:

    <?php get_header(); query_posts('posts_per_page=1'); ?>

    Here is my code for the index template. Does anyone see a solution?

    <?php get_header(); query_posts('posts_per_page=1'); ?>
    
    	<div id="content" class="narrowcolumn">
    
    	<?php if (have_posts()) : ?>
    
    		<?php while (have_posts()) : the_post(); ?>
    
    			<div class="post" id="post-<?php the_ID(); ?>">
    				<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    				<small>Published on <?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small><img class="size-full wp-image-29" style="vertical-align: top;" title="stroke_top" src="http://www.jessegunzel.com/blog/wp-content/uploads/2008/05/stroke_top.jpg" alt="" width="448" height="3" />
    <div class="entry">
    					<?php the_content('[Read the rest of this article] &raquo;'); ?>
    </div>
    Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?><?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?><p><img class="size-full wp-image-29" style="vertical-align: top;" title="stroke_top" src="http://www.jessegunzel.com/blog/wp-content/uploads/2008/05/stroke_top.jpg" alt="" width="448" height="3" /></p>
    			</div>
    
    		<?php endwhile; ?>
    <div class="navigation">
    			<div class="alignleft"><?php next_posts_link('&laquo; Older Entries') ?></div>
    			<div class="alignright"><?php previous_posts_link('Newer Entries &raquo;') ?></div>
    		</div>

    Thanks for your help!

    Jesse

Viewing 8 replies - 1 through 8 (of 8 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    I think it may be because I start out with:

    <?php get_header(); query_posts(‘posts_per_page=1’); ?>

    You thought correctly. Make your query_posts look like this instead:
    query_posts($query_string.'&posts_per_page=1');

    Otto42,

    Thanks it worked! You guys are great by the way…anytime I have a question you guys are right on.

    Best,
    Jesse

    Ok my problem has been solved above. However the “Next” and “Previous” links are not working again!! Instead, I am redirected to http://www.jessegunzel.com/blog/page/2/ which is blank.

    I did not make any changes to my code.

    http://www.jessegunzel.com/blog

    Though my problem seems similar to others, I’ve been looking around the forums but cannot find an answer because my “query_posts” code differs from everybody elses.

    Can anyone see what may have happened?

    <?php get_header(); query_posts($query_string.'&posts_per_page=3'); ?>
    
    <div id="content" class="narrowcolumn">
    
    <?php if (have_posts()) : ?>
    
    		<?php while (have_posts()) : the_post(); ?>
    
    			<div class="post" id="post-<?php the_ID(); ?>">
    				<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?><?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?>
    				<small>Published on <?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small><img class="size-full wp-image-29" style="vertical-align: top;" title="stroke_top" src="http://www.jessegunzel.com/blog/wp-content/uploads/2008/05/stroke_top.jpg" alt="" width="448" height="3" />
    <div class="entry">
    					<?php the_content('[More...] &raquo;'); ?></div>
    <p><img class="size-full wp-image-29" style="vertical-align: top;" title="stroke_top" src="http://www.jessegunzel.com/blog/wp-content/uploads/2008/05/stroke_top.jpg" alt="" width="448" height="3" /></p></div>
    <?php endwhile; ?>
    
    <div class="navigation">
    			<div class="alignleft"><?php next_posts_link('&laquo; Older Articles') ?></div>
    			<div class="alignright"><?php previous_posts_link('Newer Articles &raquo;') ?></div>
    		</div>

    Try using posts_nav_link.

    No Dice. This has to be one of the worst problems I have ever encountered using wordpress..and no matter how much I search there is never a clear difinitive answer….

    htaccess, mod-rewrites, apache, IIS, blablabla

    sighs…

    Rembrand

    (@mindbase21)

    I have the same problem ans JesseG5

    No changes made to the PHP code of my template (it’s just get_header(); in the top of the page, no code about how many posts to show).
    I use WordPress 2.6 and in the admin panel set a static page for homepage + page for the blog. My blog is located at http://www.mindbase21.be/blog and the permalinks go to blog/%postname%
    Everything works fine in the blog, until I want to got to the next page, then I get mysite/blog/page/2 and it’s an error “not found”

    One thing that I found odd, was that my blog page doesn’t use my blog.php template that I made but instead the index.php (doesn’t really matter now ’cause the code is identical)

    Rembrand

    (@mindbase21)

    I tried using this, but didn’t do anything:

    http://wordpress.org/support/topic/200788?replies=5

    Something else I’ve discovered, my working ‘page2’ is situated at http://www.mindbase21.be/page/2/
    instead of
    http://www.mindbase21.be/blog/page/2/ which is the one my navigation points to

    Rembrand

    (@mindbase21)

    I haven’t found any sollutions, so I changed my permalinks to /%postname%/, dropping the /blog/ in front of it. Now the pagination works, but of course the URL of an individual posts now also loses that /blog/. So much for customisation.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Next/Previous Links not working’ is closed to new replies.