Forums

Continious next & previous on single.php (2 posts)

  1. adelphadesign
    Member
    Posted 1 year ago #

    Please can someone advise if it is possible to have continious next previous links on my single.php page. Please see my code so far below...

    <div id="rightgall">
    <div class="pagenav">
    <?php previous_post_link('%link', '<img src="previous.jpg" width="12" height="121" alt="previous" />', TRUE); ?>
                <?php
    $prevPost = get_previous_post();
    $prevthumbnail = get_the_post_thumbnail($prevPost->ID, array(100,100) );
    previous_post_link('%link',''.$prevthumbnail.'', TRUE);
    ?></div>
    <div class="pagenav">
    <?php
    $nextPost = get_next_post();
    $nextthumbnail = get_the_post_thumbnail($nextPost->ID, array(100,100) );
    next_post_link('%link',''.$nextthumbnail.'', TRUE);
    ?>
    <?php next_post_link('%link', '<img src="next.jpg" width="15" height="121" alt="next" />', TRUE); ?>
    
    </div></div>
  2. alchymyth
    The Sweeper
    Posted 1 year ago #

    there is a plugin available which might do it:
    http://wordpress.org/extend/plugins/ambrosite-nextprevious-post-link-plus/
    even if you don't want to use it, it might be an inspiration on how to programm it.

    i could imagine that using the get_adjacent_post() to find out when you reached the end of the list of posts, and then using something like get_posts() to get the oldest or newest post, and 'get_permalink()' to build a link, should work.

    http://codex.wordpress.org/Function_Reference/get_adjacent_post
    http://codex.wordpress.org/Template_Tags/get_posts
    http://codex.wordpress.org/Function_Reference/get_permalink

Topic Closed

This topic has been closed to new replies.

About this Topic