WordPress.org

Ready to get started?Download WordPress

Forums

Single post pagination customization (2 posts)

  1. Marvel Labs
    Member
    Posted 3 years ago #

    I wish to use the following scheme for my single post pages which use nextpage-tag using wp_link_pages

    << 1|2|3|4|5|6 >>

    The problem is that the next_or_number argument lets me use either number (1,2,3,4...) or text using special characters (previous, next, <<, >>, <, >).

    How can I achieve the scheme as given above,
    at present I have done it by declaring same function (wp_link_pages) twice, on with number and other with text, but they are being displayed erroneously at: URL = http://www.marvellabs.com/glossmag/fashion/22/,

    please assist..

    Thanks in advance

  2. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    there are the global variables $numpages and $page which allow to build this pagination yourself:

    <?php if($numpages > 1) : //hand-coded link-pages navi
    if($page>1) { $prev_page = $page-1; echo '<a href="'.get_permalink($post->ID).'/'.$prev_page.'/">&laquo; </a>'; }
    else { echo '&laquo; '; } // one step back
    for($i=1; $i<=$numpages; $i++) :
    if($i>1) echo '|';
    if($page==$i) { echo ' ' . $i . ' '; } else { echo '<a href="'.get_permalink($post->ID).'/'.$i.'/"> ' . $i . ' </a>'; }
    endfor;
    if($page<$numpages) { $next_page = $page+1; echo '<a href="'.get_permalink($post->ID).'/'.$next_page.'/"> &raquo;</a>'; }
    else { echo ' &raquo;'; } // one step up
    endif; //end of hand-coded link-pages navi ?>

Topic Closed

This topic has been closed to new replies.

About this Topic