Forums

Next and Previous post - image rollovers (3 posts)

  1. machination
    Member
    Posted 1 year ago #

    Hello,

    This code is working fine for me in terms of rollovers:

    <div id="sidebar_navbuttons">
       <div class="previmg"><?php if(get_previous_posts_link()) { previous_posts_link('Newer Entries »'); } else { echo 'No Newer Entries'; } ; ?></div>
       <div class="nextimg"><?php if(get_next_posts_link()) { next_posts_link('« Older Entries'); } else { echo 'No Older Entries'; } ; ?></div>
    </div>

    So I have the CSS working.
    However, the images don't actually link to the previous post or the next post. Even when I take the images away and just have text, it doesn't work.

    Any idea on why the above isn't linking to the previous post and next post? Do I have to modify the code in some way?

    Thanks.

  2. alchymyth
    The Sweeper
    Posted 1 year ago #

    are they linking at all?
    if so, where to?
    do the checks on the last and first page work?

    where is the code in realtion to the main loop?

    is there possibly some custom query inbetween?
    if so, try to add wp_reset_query(); before your snippet.

    link to your site to illustrate the issue?

  3. machination
    Member
    Posted 1 year ago #

    No, the link does not work at all.

    I'm only using this for specific project-related posts.

    The code is within a custom widget.

    Don't think I can link to the site yet. I'm going to try the image rollover plugin to see if that works instead, and that way I can keep it in this format:

    <?php previous_post_link('%link', '<img src="../img/prev.png" alt="Previous" />

Topic Closed

This topic has been closed to new replies.

About this Topic