WordPress Пагинация без Плагина | Only to top
Tue Jan 11 2022 02:54:33 GMT+0000 (Coordinated Universal Time)
Saved by
@ilyayakusheff
function my_pagination()
{
global $wp_query;
if (is_front_page()) {
$currentPage = (get_query_var('page')) ? get_query_var('page') : 1;
} else {
$currentPage = (get_query_var('paged')) ? get_query_var('paged') : 1;
}
$pagination = paginate_links([
'base' => str_replace(999999999, '%#%', get_pagenum_link(999999999)),
'format' => '',
'current' => max(1, $currentPage),
'total' => $wp_query->max_num_pages,
'type' => 'list',
'prev_text' => '«',
'next_text' => '»',
]);
echo str_replace('page-numbers', 'pagination', $pagination);
}
content_copyCOPY
https://only-to-top.ru/blog/programming/2021-03-04-wordpress-paginaciya.html
Comments