我的wordpress主页有问题,特殊优惠分页不起作用,请点击链接和代码。
如果单击pag,列出的2个产品是相同的。
function atpmenutypepagination($range =2,$pages = '') {
global $paged,$wp_query;
$out='';
$showitems = ($range * 2)+1;
if(empty($paged)) $paged = 1;
if($pages == ''){
$pages = $wp_query->max_num_pages;
if(!$pages){
$pages = 1;
}
}
//if pages more than one
if(1 != $pages){
$out.='<div class="pagination wp-pagenavi">
<span class="pages extend">
Pag '.$paged.' de '.$pages.
'</span>';
if($paged > 2 && $paged > $range+1 && $showitems < $pages) $out.='<a href="'.get_pagenum_link(1).'">«</a>';
if($paged > 1 && $showitems < $pages) $out.='<a href="'.get_pagenum_link($paged - 1).'">‹</a>';
for ($i=1; $i <= $pages; $i++){
if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems )) {
$out.=($paged == $i)? '<span class="current">'.$i.'</span>':'<a href="'.get_pagenum_link($i).'" class="inactive" >'.$i.'</a>';
}
}
if ($paged < $pages && $showitems < $pages) $out.='<a href="'.get_pagenum_link($paged + 1).'">›</a>';
if ($paged < $pages-1 && $paged+$range-1 < $pages && $showitems < $pages) $out.='<a href="'.get_pagenum_link($pages).'">»</a>';
$out.= '</div>';
}
return $out;
}//end of function atpmenutypepagination