/ Published in: PHP

Create navigation links without the need of a plugin, using paginate_links function of wordpress core.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// put it in your functions.php of your theme, enjoy :) function show_pagination_links() { global $wp_query; $page_tot = $wp_query->max_num_pages; $page_cur = get_query_var( 'paged' ); $big = 999999999; if ( $page_tot == 1 ) return; 'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ), // need an unlikely integer cause the url can contains a number 'format' => '?paged=%#%', 'total' => $page_tot, 'prev_next' => true, 'end_size' => 1, 'mid_size' => 2, 'type' => 'list' ) ); }
Comments
