Support » How-To and Troubleshooting » [Resolved] Help with "Next" and "Previous" code

[Resolved] Help with "Next" and "Previous" code

  • Hey,

    I’m trying to change the “next and “preivous” text links into images, but I can’t seem to get the code right. Can anyone lend a hand? Here’s the code from my index.php file:

    <div id="nextprevious">
    <div class="alignleft"><?php posts_nav_link('','','&laquo; PREVIOUS ENTRIES') ?></div>
    <div class="alignright"><?php posts_nav_link('','NEXT ENTRIES &raquo;','') ?></div>
    <div class="cleared"></div>


Viewing 8 replies - 1 through 8 (of 8 total)
  • have you tried to follow the example in http://codex.wordpress.org/Function_Reference/posts_nav_link

    Yes, using that code makes the navigation disappear entirely. I think I have that Kubrick problem and I’m not sure how to fix it within this theme (Pixeled).

    Yes, using that code makes the navigation disappear entirely.

    can you still see some of the next/prev code in the html in the browser?
    link to your site?

    what happens if you try to use next_posts_link() and previous_posts_link() with the image code instead?

    I’m probably not coding it right, but I was able to get one button to appear using this code:

    <div id="nextprevious">
    <?php posts_nav_link( ' ', '<img src="' . get_bloginfo('stylesheet_directory') . '/images/prev.png" />', '<img src="' . get_bloginfo('stylesheet_directory') . '/images/next.png" />' ); ?>
    </div> <!-- Closes contentwrapper-->

    However, it only seems to be the NEXT button. The PREVIOUS button just disppears.

    My site is http://flowersarepretty.com

    Here’s the original Index.php for reference:

    [moderated: chunk of code removed as per forum rules – please use a pastebin for larger amounts of code]

    Okay, I think it’s sort of working now. But notice on this page (http://flowersarepretty.com/?paged=2) how NEXT and PREVIOUS are right next to each other. Any way to fix that so they are on either side of the post like before?

    your latest code seems to have lost the divs with the .alignleft and .alignright css classes.

    you might be able to add something like:
    style="float:left;" and/or style="float:right;" to your code;

    post the few lines of the nav if not sure (using the code button or backticks); for larger code please use the http://wordpress.pastebin.com/

    That worked! Here’s the final code. Not sure if I did it right, but it works. 🙂

    <div id="nextprevious">
    <?php posts_nav_link( ' ', '<img src="' . get_bloginfo('stylesheet_directory') . '/images/next.png" style="float:right;"/>', '<img src="' . get_bloginfo('stylesheet_directory') . '/images/prev.png" style="float:left;" />' ); ?>
    </div> <!-- Closes contentwrapper-->

    Thanks so much for your help!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Resolved] Help with "Next" and "Previous" code’ is closed to new replies.
Skip to toolbar