Support » Plugin: WP-PageNavi » [Plugin: WP-PageNavi] Option to always show First/Previous/Next/Last?

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author scribu

    (@scribu)

    Why would you need that?

    I just like the way it would look, so the page numbers themselves do not shift to the left when the First/Previous button disappears.

    If they are always shown (maybe greyed out if they don’t apply) then the width of the pagenavi display would always remain fixed, and if I was displaying say 5 page numbers, only the numbers would change but would not move position.

    Thanks

    jsherk – did you ever find a way to do this?

    No I did not … sorry 🙁

    Open core.php

    For Previous
    at line 83:
    if ( $paged > 1 && !empty( $options[‘prev_text’] ) )

    change it like this:
    if ( 1 || $paged > 1 && !empty( $options[‘prev_text’] ) )

    For Next
    at line 141:
    if ( $paged < $total_pages && !empty( $options[‘next_text’] ) )

    change it like this:
    if ( 1 || $paged < $total_pages && !empty( $options[‘next_text’] ) )

    find First and Last, and just add 1 with OR condition.

    easy 🙂

    Awesome! Yes easy!

    Thanks

    Oh there is a problem, when u r at last page then if u press next button it will try to go total page+1, and redirect to home page. to solve this problem add this code

    // Next
    if ( 1 || $paged < $total_pages && !empty( $options[‘next_text’] ) ) {
    if($paged = $total_pages)
    {
    $paged = $total_pages;
    }
    else {
    $paged++;
    }
    $out .= $instance->get_single( $paged, ‘nextpostslink’, $options[‘next_text’] );
    }

    Why hack the core? That only makes sure you need to re-apply the changes when there’s an update of the plugin. I just added the previous / next links like this:

    <?php 
    
    // Pagina nummering
    if ( function_exists('wp_pagenavi') )
    {
    	ob_start();
    	wp_pagenavi();
    
    	$pagenavi = ob_get_contents();
    	ob_end_clean();
    
    	if ( !strstr($pagenavi, 'previouspostslink') ) $pagenavi = str_replace('<span', '<span class="previouspostslink">⇠ Vorige</span>'."\r\t".'<span', $pagenavi);
    	if ( !strstr($pagenavi, 'nextpostslink') ) $pagenavi = str_replace('</div>', '<span class="nextpostslink">Volgende ⇢</span>'."\r".'</div>', $pagenavi);
    
    	echo $pagenavi;
    }
    
    ?>

    And the same can be done for the first/last links.

    Oh and @jsherk, if the topic is resolved, could you please mark it like that too? 🙂

    Thanks Hiranthi. Solved my problem too. See you soon! (hopefully)

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘[Plugin: WP-PageNavi] Option to always show First/Previous/Next/Last?’ is closed to new replies.