Support » Theme: Leaf » Changing pagination

  • Resolved koustourika


    Hi, again,

    i wanted to change the pagination of the blog (at the footer of each “blog” page, add more ‘pages numbers’ than 4).
    I installed the plugin WP-Pagenavi, but nothin changed. So i wondered if there is another trick than this plugin to do this.

    for exemple, at the foot of this page, after “Page 1 of 8”, i want direct access to all the page. At least for the 15 first pages in a near future.
    How i can do this?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Michael


    Forum Moderator

    you have not mentioned if you have updated the wp-pagenavi options:

    yeah for sure. But i can change whatever i need in wp-pagenavi options, nothing changes on the blog.
    Any cached plugin actived too.

    ^replace “whatever i need” by “whatever i want”.



    Forum Moderator

    ignore(you are right – I just activated wp_pagenavi, and the plugin seem to ignore those settings.)

    turns out that the theme is not using wp_pagenavi at all;

    the pagination is made by this function leaf_pagination() in the theme’s sub folder /includes/theme-plugins.php

    ok, i get it. Right here isn’t it?

    function leaf_pagination($pages = '', $range = 3) {   /* handle pagination for post pages*/
    		$showitems = ($range * 2)+1;  
    		global $paged;
    		if(empty($paged)) $paged = 1;
    			if($pages == '') {
    				global $wp_query;
    				$pages = $wp_query->max_num_pages;
    				if(!$pages) {
    					$pages = 1;
    			if(1 != $pages)
    				echo "<div class=\"pagination\"><span>Page ".$paged." of ".$pages."</span>";
    				if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "<a href='".get_pagenum_link(1)."'>&laquo; First</a>";
    				if($paged > 1 && $showitems < $pages) echo "<a href='".get_pagenum_link($paged - 1)."'>&lsaquo; Previous</a>";
    				for ($i=1; $i <= $pages; $i++)
    					if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems ))
    						 echo ($paged == $i)? "<span class=\"current\">".$i."</span>":"<a href='".get_pagenum_link($i)."' class=\"inactive\">".$i."</a>";
    				if ($paged < $pages && $showitems < $pages) echo "<a href=\"".get_pagenum_link($paged + 1)."\">Next &rsaquo;</a>";
    				if ($paged < $pages-1 &&  $paged+$range-1 < $pages && $showitems < $pages) echo "<a href='".get_pagenum_link($pages)."'>Last &raquo;</a>";
    				echo "</div>\n";
    	} //  leaf_pagination

    it’s a lil bit complicated for me.
    i was wondering if someone had at least a working plugin to do this.
    Im scared to do a mistake by editing this.

    Or do i need to do something particular that can help WPPageNavi working?

    Theme Author bradthomas127


    @koustourika – See where it says
    function leaf_pagination($pages = '', $range = 3)
    On the first line, bump the 3 up to a higher number.

    Great. Works like a charm 😉
    good job.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Changing pagination’ is closed to new replies.