To create a dynamic pagination
Sat May 14 2022 10:38:29 GMT+0000 (UTC)
Saved by
@QQcoder
#pagination
#function
// place the codes in functions.php and call the function wherever you want.
function philosophy_pagination()
{
global $wp_query;
$links = paginate_links(array(
'current' => max(1, get_query_var('paged')),
'total' => $wp_query->max_num_pages,
'type' => 'list',
'mid_size' => 3,
));
$links = str_replace('page-numbers', 'pgn__num', $links);
$links = str_replace("<ul class='pgn__num'>", "<ul>", $links);
$links = str_replace('next pgn__num', 'pgn__next', $links);
$links = str_replace('prev pgn__num', 'pgn__prev', $links);
echo wp_kses_post($links);
}
content_copyCOPY
Comments