Aşağıdaki sayfaloandırma kodunda sayfa sayısı Wordpress ayarlarındaki
BU alandaki değere göre hesaplanıyor. Benim istediğim ise buradan bağımsız olarak php kodundan değer girebilmek, mesela 12 yerine 18. Bu ayarı çeken yer neresi ise (nasırım "// init pages" kısmı) onun iptal olması gerekiyor, ek bir fonksiyonu kodu da oluşturulabilir bunun için bilmiyorum nasıl çözülebileceğini.
İlgili dokuman:
https://codex.wordpress.org/Pagination
Dokumanda sorumun cevabı yazıyor büyük ihitmalle ama ben anlamadım, uğraştım uğraştım yapamadım.
function laura_numeric_pagination_dog($pages = '', $range = 1) {
$pagination_number = get_theme_mod( 'laura_pagination_max_number', 4 ) / 2;
global $paged;
$showitems = ($range * 2)+1; // links to show
// init paged
if(empty($paged))
$paged = 1;
// init pages
if($pages == '') {
global $wp_query;
$pages = $wp_query->max_num_pages;
if(!$pages)
$pages = 1;
}
// if $pages more then one post
if(1 != $pages) {
echo '<div class="col-xs-12 center-xs numeric-pagination">';
// Previous link
if($paged > 1 && $showitems < $pages)
echo '<a href="'.get_pagenum_link($paged - 1).'">'; _e( 'Previous Page', 'laura' ); echo '</a>';
// Links of pages
for ($i=1; $i <= $pages; $i++)
if (1 != $pages && ( !($i >= $paged+$range+$pagination_number || $i <= $paged-$range-$pagination_number) || $pages <= $showitems ))
echo ($paged == $i) ? '<span>' . $i . '</span>' : '<a href="' . get_pagenum_link($i) . '">' . $i . '</a>';
// Next link
if ($paged < $pages && $showitems < $pages)
if( get_theme_mod( 'laura_translation_active', 0 ) == 1 && !empty( $next_page_text ) ) {
echo '<a href="' . get_pagenum_link($paged + 1) . '">'; _e( 'Next Page', 'laura' ); echo '</a>';
echo '</div>';
}
}Not: Konu Wordpress'den ziyade PHP ile ilgili olduğu için bu kategoriye açtım.