Support » Fixing WordPress » Next and Prev links not working

  • Hi there, need help with the next & Prev links, they work on localhost but they dont on the hosting server.
    This is how i did it <?php next_posts_link(‘Next’); ?>
    What should I do?

Viewing 15 replies - 1 through 15 (of 15 total)
  • Oh ,I want to display 5posts per page, need help with the next & Prev links, they work on localhost but they dont on the hosting server.
    This is how i did it <?php next_posts_link(‘Next’); ?>
    What should I do?

    Should work. What’s the url?

    Im not sure which url you are looking for, so this is the url to the site that im woking on http://www.harukami.co.za/blog/

    Hey just found out, this links only are working on the home.php page but they dont on the category.php page.

    So did you add the navigation links in category.php?

    I did, but i ended up removing them!

    But this is how it should be, Is that so? or should I say this how I want it to be.

    <?php get_header(); ?>
    
     <?php global $query_string; query_posts( $query_string . '&posts_per_page=4'); ?>
    
      <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
      <div class="post">
       <div class="date"><?php the_time('F dS Y'); ?></div>
         <div class="title"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></div>
     <div class="tags">
     <?php the_tags('Selected works: ', ', ', '<br />'); ?>
    </div>
    
         <div class="entry">
        <?php the_content( '<div id="entry-more">More Information</div>' ); ?>
        <div id="separate">|</div>
        <div id="comm"><?php comments_popup_link('No Comments', '1 Comment', '% Comments'); ?></div>
    
       <div id="dividerLine"></div>
    
         </div>
        </div>
         <?php endwhile; ?>
    
    <div id="navigation">
    	 <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); }
    			else { ?>
                            <div id="prev_link"><?php previous_posts_link('&laquo; Previous') ?></div>
    			<div id="next_link"><?php next_posts_link('Next &raquo;') ?></div>
    			<?php } ?>
    <!-- Page number inattivo
    <?php if(function_exists('wp_page_numbers')) : wp_page_numbers(); endif; ?>
    --></div>
    
    <?php else: ?>
        <h2>Not Found</h2>
        <p>Sorry, but you are looking for something that isn't here.</p>
        <?php endif; ?>
    <?php get_sidebar();?>
    <?php get_footer();?>

    Yes that should work.

    Thanks,

    Well I dont know what’s wrong with it, it only works well on the home.php page but I also need it on the category page.

    There’s no plugin that I should install and activate?

    By the way,

    I also wanted to add categories on my sidebar, look at this link here http://harukami.co.za/blog/

    If you notice there’s a heading named Case Studies which displays categories, Other Links to be the same, but display different categories.

    Do you have an idea on how I could do that?

    No for the basic navigation you don’t need to activate any plugin. First deactivate any plugins you have activated. The navigation should have classes instead of id’s like so

    <div class="navigation">
    	 <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); }
    			else { ?>
                            <div class="prev_link"><?php previous_posts_link('&laquo; Previous') ?></div>
    			<div class="next_link"><?php next_posts_link('Next &raquo;') ?></div>
    			<?php } ?>
    <!-- Page number inattivo
    <?php if(function_exists('wp_page_numbers')) : wp_page_numbers(); endif; ?>
    --></div>

    and change your css accordingly ,#navigation to .navigation etc.

    See if it works now. If not change the navigation part like this

    <div class="navigation">
                            <div class="prev_link"><?php previous_posts_link('&laquo; Previous') ?></div>
    			<div class="next_link"><?php next_posts_link('Next &raquo;') ?></div>
    </div>

    And for the categories in the sidebar you can use list_categories.
    http://codex.wordpress.org/Template_Tags/wp_list_categories

    Hi bmabetha,
    Instead of this query string <?php global $query_string; query_posts( $query_string . '&posts_per_page=4'); ?> use the following query. It should work.

    <?php
        global $paged;
        if(!$paged) {
            query_posts('showposts=4');
        }else {
            query_posts('showposts=4&paged=' . $paged);
        }
    ?>

    Or just delete the query

    <?php global $query_string; query_posts( $query_string . '&posts_per_page=4'); ?>

    and go dashboard > settings > reading and set Blog pages show at most to 5.

    That should fix it.

    Hey, Thanks a lot, if finally works, this is how is did id

    Or just delete the query

    <?php global $query_string; query_posts( $query_string . '&posts_per_page=4'); ?>

    and go dashboard > settings > reading and set Blog pages show at most to 5.

    That should fix it.


    Now let me try the category links.

    Many Thanks!!

    To: abooze

    Thanks to you too man.
    Is finally working, I just removed this <?php global $query_string; query_posts( $query_string . '&posts_per_page=4'); ?>

    and went to dashboard > settings > reading and set Blog pages show at most to 5. as Xam 1.0 said and it worked well on all pages!

    But thanks to you too man.

Viewing 15 replies - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.