WordPress.org

Forums

Pagination Problem (4 posts)

  1. Direnk
    Member
    Posted 2 years ago #

    Hi everyone,

    I have a little problem with the pagination. In homepage 10 Recent posts displays. I tried to add pagination before footer section by adding this code:

    <?php kriesi_pagination($pages = '', $range = 2); ?>

    Now, pagination is visible at the right place but /page/2/ URL's are not working. Same (recent) 10 posts shows up in every /page/# URL's.

    This is the related code from functions.php.

    function kriesi_pagination($pages = '', $range = 2)
    {
         $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'><div style='margin-top:7px; float:right; font-size:10pt; font-family:Tahoma;'>Page ".$paged." of ".$pages."</div>";
             if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "<a href='".get_pagenum_link(1)."'>&laquo;</a>";
             if($paged > 1 && $showitems < $pages) echo "<a href='".get_pagenum_link($paged - 1)."'>&lsaquo;</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)."'>&rsaquo;</a>";
             if ($paged < $pages-1 &&  $paged+$range-1 < $pages && $showitems < $pages) echo "<a href='".get_pagenum_link($pages)."'>&raquo;</a>";
             echo "</div>\n";
         }
    }

    Hope you can help me! Thanks.

  2. alchymyth
    Forum Moderator
    Posted 2 years ago #

    more likely related to some query in the template;

    what is the code of the full template?

    what theme are you using?

  3. Direnk
    Member
    Posted 2 years ago #

    I am using Monroe theme,

    http://themeforest.net/item/monroe-responsive-wordpress-magazine-news/full_screen_preview/3144261

    Pagination of single category sections works well, as you can see in the demo, but homepage is not working. Do you need any other code?

  4. alchymyth
    Forum Moderator
    Posted 2 years ago #

    as you are working with a commercial theme, please contact the theme's developer for support.

    http://codex.wordpress.org/Forum_Welcome#Commercial_Products

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags