Skip to content

Instantly share code, notes, and snippets.

@pvphong90
Created November 24, 2018 07:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pvphong90/a4a58e08036279571d91aeaf5db6f92d to your computer and use it in GitHub Desktop.
Save pvphong90/a4a58e08036279571d91aeaf5db6f92d to your computer and use it in GitHub Desktop.
Code phân trang wordpress
function html5wp_pagination()
{
global $wp_query;
$big = 999999999;
$pages = paginate_links(array(
'base' => str_replace($big, '%#%', get_pagenum_link($big)),
'format' => '?paged=%#%',
'current' => max(1, get_query_var('paged')),
'total' => $wp_query->max_num_pages,
'type' => 'array',
));
if( is_array( $pages ) ) {
$paged = ( get_query_var('paged') == 0 ) ? 1 : get_query_var('paged');
echo '<div class="text-center"><ul class="pagination bounceInUp animated wow" data-wow-delay=".8s">';
foreach ( $pages as $page ) {
echo "<li>$page</li>";
}
echo '</ul></div>';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment