/ Published in: HTML
I dont remember the author this code.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function paglink($first=1,$last=1,$middle=10,$baseURL=false,$wp_query=false ) { if(!$baseURL) $baseURL= get_bloginfo('url'); if(!$wp_query)global $wp_query; $page = $wp_query->query_vars["paged"]; if ( !$page ) $page = 1; $qs = $_SERVER["QUERY_STRING"] ? "?".$_SERVER["QUERY_STRING"] : ""; if ( $wp_query->found_posts > $wp_query->query_vars["posts_per_page"] ) { echo '<div class="box-paginacao">'; if ( $page > 1 ) { } else { } $dots=false; echo '<div class="paginas">'; for ( $i=1; $i <= $wp_query->max_num_pages; $i++ ){ // Loop through pages if($i<=$first || $i<=$middle && $page<$middle || $i>$wp_query->max_num_pages-$last || $i>$wp_query->max_num_pages-$middle && $page>$wp_query->max_num_pages-$middle+1 || $i>$page-ceil($middle/2) && $i<=$page+floor($middle/2)){ if ( $i == $page ) { // Current page or linked page? echo '<strong>'.$i.'</strong>'; } else { } $dots=false; }elseif(!$dots){ $dots=true; } } echo '</div>'; if ( $page < $wp_query->max_num_pages ) { // Next link? } else { } echo '</div>'; } } //use function paglink(1, 1, 10, get_bloginfo('wpurl').'/your_post_type_or_categories/', $wp_query);