Snippets Collections
// 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);
}
star

Tue May 31 2022 14:49:26 GMT+0000 (UTC) https://wordpress.stackexchange.com/questions/53194/wordpress-paginate-wpdb-get-results

#wordpress #wpdb #pagination #php
star

Sat May 14 2022 10:38:29 GMT+0000 (UTC)

#pagination #function

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension