Add pagination to the posts retrieved by below query [duplicate]

<?php $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $news= new WP_Query(array( ‘post_type’=>’post’, ‘posts_per_page’ => 3, ‘paged’ => $paged, )); if($news->have_posts()) : while($news->have_posts()) : $news->the_post(); the_title(); endwhile; $total_pages = $news->max_num_pages; if ($total_pages > 1){ $current_page = max(1, get_query_var(‘paged’)); echo paginate_links(array( ‘base’ => get_pagenum_link(1) . ‘%_%’, ‘format’ => ‘/page/%#%’, ‘current’ => $current_page, ‘total’ => $total_pages, ‘prev_text’ => … Read more

Making a Killer wp_link_pages

Your pagination links are wrapped in with this tag <p class=”pagelinks”> so giving them all the same spacing is easy using CSS like so: .pagelinks a { margin: 0 5px !important; } /* override other defined margins */ maybe you want them all centered on the page too: .pagelinks { display:block; text-align:center; } making the … Read more

foreach pagination

Here is the code I used to solve my problem: <?php $url = $_SERVER[“REQUEST_URI”]; $segments = explode(“https://wordpress.stackexchange.com/”, $url); $page = is_numeric($segments[count($segments)-2]) ? $segments[count($segments)-2] : 1; $next = $page + 1; $prev = $page – 1; $issues_per_page = 11; $lastpage = ceil(wp_count_terms( ‘mag’) / $issues_per_page) ; ?> <?php wp_count_terms( ‘mag’ ); ?> <table> <tr> <?php $col … Read more

How can I remove page slug for all pagings?

Add this code to your functions.php and please re-save your permanent link page and do not forget 301 redirects add_action( ‘init’, ‘remove_page’ ); function remove_page(){ global $wp_rewrite; $wp_rewrite->pagination_base = “”; }

How to reduce the number of pages in pagination

I believe you’re using 2 custom functions one of them is emm_paginate_loop() you’re showing. But i saw that settings for that custom pagination is on function emm_paginate() and specifically “gap”: ‘gap’ – Default is 3 (int). The minimum number of pages before a gap is replaced with ellipses (…). But that only sets a minimum … Read more