Articles of paginate links

Unable to get paginate_links working with a custom query

This question already has an answer here: How to fix pagination for custom loops? 4 answers

Paginated pages are showing correct content but pagination links are not

I am using a custom WP_Query to display posts on static front page. and generating numbered pagination links with paginate_links functions. This is the code I have… $latest_args = array( ‘post_type’ => ‘post’, ‘category__not_in’ => array( 3 ), ‘ignore_sticky_posts’ => 1, ‘paged’ => $paged, ); $latest_query = new WP_Query( $latest_args ); if ( $latest_query->have_posts() ) […]

Custom Search Page Pagination Not Working

My Seach Page URLs: Here my custom search page: <?php if($_GET[‘search_text’] && !empty($_GET[‘search_text’])) { $text = $_GET[‘search_text’]; } else { $text = urldecode( get_query_var(‘search_text’) ) ; } ?> <div id=”primary” class=”content-area”> <main id=”main” class=”site-main” role=”main”> <div class=”searchpage-container”> <div class=”searchpage-filter-container”> <span>Arama Sonuçları:</span> </div> <div class=”product-container”> <?php $my_products = array( 2085, 4094, 2900, 4072, 131 ); […]

Strange paginate_links behavior. First page link is always whatever page I'm on, all other links are correct

I’m using the following code to generate some pagination: $wp_query = new WP_Query(); $wp_query->query(‘posts_per_page=5′.’&paged=’.$paged); $big = 999999999; echo ‘<div class=”pagination”>’; echo paginate_links(array( ‘base’ => ‘%_%’, ‘format’ => str_replace($big, ‘%#%’, esc_url(get_pagenum_link( $big ))), ‘current’ => max( 1, get_query_var(‘paged’) ), ‘total’ => $wp_query->max_num_pages, ‘end_size’ =>4, ‘type’ => ‘list’)); echo ‘</div>’; Its generating my links correctly on the […]

How to paginate attachments in a secondary query as gallery?

I have this code that shows all images attached to my post-type. Is there a way to paginate those? I have like 25 pics and I wan’t to avoid scroll as much as I can. Code: <div class=”galleries ten columns”> <?php $attachments = get_posts( array( ‘post_type’ => ‘attachment’, ‘post_mime_type’=>’image’, ‘posts_per_page’ => -1, ‘post_status’ => ‘any’, […]

Paginate links with “ugly” and “pretty” permalinks?

If I have “pretty” permalinks enabled my code will work for static pages (will work if page is set as “home page” or “normal page” ). But my code breaks if I use “default permalink” structure. I have this so far (working nice with “pretty permalinks” but breaks with “ugly permalinks”): /*Declared above the loop*/ […]

How to edit or override a Core function?

I want to add a data argument to links generated by the paginate_links() function. Then, I can more easily extend my custom pagination to use AJAX. As far as I can tell, this function is not pluggable, nor does it have any hooks available. The links generated by paginate_links() look like this: <a class=”page-numbers” href=””><span […]

Changing pagination list class

paginate_links() function returns unordered list with class named “page-numbers”. How can I change this class? EDIT Currently, I am using the band-aid method below. $return = paginate_links( $arg ); echo str_replace( “<ul class=’page-numbers’>”, ‘<ul class=”pagination”>’, $return ); Is there any better way?

WordPress Pagination Problem

I want to put Pagination in my wordpress index.php but it does not work. In my index.php there are 3 section of loop that show custom posts and i want put pagination in Blog / recent post section loop in index.php. this is the code in index.php <?php /** * @package WordPress * @subpackage Adapt […]

paginate_links() don't properly work in search.php?

I’m using this in my search.php template … <div class=”pagination”> <?php echo get_pagination_links(); ?> </div> And this is the function … function get_pagination_links() { global $wp_query; $big = 999999999; return paginate_links( array( ‘base’ => str_replace( $big, ‘%#%’, esc_url( get_pagenum_link( $big ) ) ), ‘format’ => ‘?paged=%#%’, ‘current’ => max( 1, get_query_var(‘paged’) ), ‘total’ => $wp_query->max_num_pages, […]