you are here: codestackercodes [RSS]page x of y in wordpress

page x of y in wordpress

based on http://design.sparklette.net/teaches/how-to-add-wordpress-pagination-without-a-plugin/

<?php

// paste in functions.php

function pagination($pages = '', $range = 4){
     $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 "Page ".$paged." of ".$pages;
     }
}

?>



<?php

// in your template 

if (function_exists("pagination")) { pagination($additional_loop->max_num_pages); } 

?>

Comments