WordPress.org

Ready to get started?Download WordPress

Forums

Leaf
[resolved] Changing pagination (9 posts)

  1. koustourika
    Member
    Posted 1 year ago #

    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?

  2. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

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

    http://wordpress.org/extend/plugins/wp-pagenavi/screenshots/

  3. koustourika
    Member
    Posted 1 year ago #

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

  4. koustourika
    Member
    Posted 1 year ago #

    ^replace "whatever i need" by "whatever i want".
    sorry

  5. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    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

  6. koustourika
    Member
    Posted 1 year ago #

    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.

  7. koustourika
    Member
    Posted 1 year ago #

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

  8. bradthomas127
    Member
    Theme Author

    Posted 1 year ago #

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

  9. koustourika
    Member
    Posted 1 year ago #

    Great. Works like a charm ;)
    good job.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic

Tags

No tags yet.