Bună,
Dacă o temă nu permite numerotarea paginilor și nici plugin-urile gen WP-PageNavi sau OB Page Numbers nu funcționează pe acea temă, s-ar putea face ceva în codul temei pentru a se putea afișa numerotarea paginilor?
Mulțumesc!
Bună,
Dacă o temă nu permite numerotarea paginilor și nici plugin-urile gen WP-PageNavi sau OB Page Numbers nu funcționează pe acea temă, s-ar putea face ceva în codul temei pentru a se putea afișa numerotarea paginilor?
Mulțumesc!
Adauga in functions.php
si pentru afisare foloseste:function wp_pagenavi($before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 5, $always_show = false) {
global $request, $posts_per_page, $wpdb, $paged;
if(empty($prelabel)) { $prelabel = '«';
} if(empty($nxtlabel)) {
$nxtlabel = '»';
} $half_pages_to_show = round($pages_to_show/2);
if (!is_single()) {
if(!is_category()) {
preg_match('#FROM\s(.*)\sORDER BY#siU', $request, $matches); } else {
preg_match('#FROM\s(.*)\sGROUP BY#siU', $request, $matches); }
$fromwhere = $matches[1];
$numposts = $wpdb->get_var("SELECT COUNT(DISTINCT ID) FROM $fromwhere");
$max_page = ceil($numposts /$posts_per_page);
if(empty($paged)) {
$paged = 1;
}
Si acum ar trebui sa mearga.if(function_exists('wp_pagenavi')) { wp_pagenavi('', '', '', '', 3, false);}
--- Later Edit --- (ca mi-a fost lene sa apas "Edit")
Scuze!
Nu ti-am dat toata functia din functions.php
function wp_pagenavi($before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 5, $always_show = false) {
global $request, $posts_per_page, $wpdb, $paged;
if(empty($prelabel)) { $prelabel = '«';
} if(empty($nxtlabel)) {
$nxtlabel = '»';
} $half_pages_to_show = round($pages_to_show/2);
if (!is_single()) {
if(!is_category()) {
preg_match('#FROM\s(.*)\sORDER BY#siU', $request, $matches); } else {
preg_match('#FROM\s(.*)\sGROUP BY#siU', $request, $matches); }
$fromwhere = $matches[1];
$numposts = $wpdb->get_var("SELECT COUNT(DISTINCT ID) FROM $fromwhere");
$max_page = ceil($numposts /$posts_per_page);
if(empty($paged)) {
$paged = 1;
}
if($max_page > 1 || $always_show) {
echo "$before <div class='Nav'><span>Pages ($max_page): </span>"; if ($paged >= ($pages_to_show-1)) {
echo '<a href="'.get_pagenum_link().'">« first</a> '; }
previous_posts_link($prelabel);
for($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) { if ($i >= 1 && $i <= $max_page) { if($i == $paged) {
echo "<span class='on'>$i</span>";
} else {
echo ' <a href="'.get_pagenum_link($i).'">'.$i.'</a> '; }
}
}
next_posts_link($nxtlabel, $max_page);
if (($paged+$half_pages_to_show) < ($max_page)) {
echo ' <a href="'.get_pagenum_link($max_page).'">last »</a>'; }
echo "</div> $after";
}
}
}
Momentan este/sunt 1 utilizator(i) care navighează în acest subiect. (0 membrii și 1 vizitatori)