Allow variable amount of comments before pagination

This have several components to it – what option itself holds and how value from it is stashed away and reused by various pieces of core code. I am not sure this is perfect, but my quick take would be: new Adjust_Comments_Per_Page( 10, ‘years’, ‘category’ ); class Adjust_Comments_Per_Page { private $amount; private $term; private $taxonomy; … Read more

Aggregate comments, with pagination

Most likely, the main thing that you missed is that you must have “Break comments into pages” checked in the Settings Discussion Subpanel. The pagination functions require this to be set, as do the URL rewrites. Here’s a working, complete page template to do what you’re asking: <?php /* Template Name: All Comments See http://wordpress.stackexchange.com/questions/63770/aggregate-comments-with-pagination … Read more

Paginate result set from $wpdb->get_results()

You can use the function paginate_links() for any pagination. For your specific case: $total = $wpdb->get_var(” SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE user_id = $thisauthor->ID AND comment_post_id = ID AND comment_approved = 1 “); $comments_per_page = 100; $page = isset( $_GET[‘cpage’] ) ? abs( (int) $_GET[‘cpage’] ) : 1; echo paginate_links( array( ‘base’ => add_query_arg( ‘cpage’, … Read more

Modify previous and next text from pagination links

I found out a way that you can place any text. You just need to create an array where you want the paginate_links to appear. <!– Put this in your functions.php –> <?php $args = array( ‘base’ => ‘%_%’, ‘format’ => ‘?paged=%#%’, ‘total’ => 1, ‘current’ => 0, ‘show_all’ => false, ‘end_size’ => 1, ‘mid_size’ … Read more

How to get the number of Pages in a single Post Pagination?

Inside the loop, as michael pointed out you could just refer to $numpages global variable. Outside of the loop, your code is almost fine. Being the number of the pages the number of <!–nextpage–> + 1, you could save a function call by doing: $numOfPages = 1 + substr_count($the_post->post_content, ‘<!–nextpage–>’); As a quick and not-that-dirty … Read more

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

I’m fairly certain this is answered elsewhere, but I’ll add it here again. I believe your issue lies here: ‘current’ => max( 1, get_query_var(‘paged’) ), Try this instead: global $wp_query; $wp_query->query_vars[‘paged’] > 1 ? $current = $wp_query->query_vars[‘paged’] : $current = 1; …then: ‘current’ => $current; Your ‘base’ may also be an issue. Instead of this: … Read more

Pagination on a WP_query not showing navigation links

Please do not use showposts it got replaced by posts_per_page ages ago. Personally I would add the arguments to the WP_Query like shown below, additionally pagination should work like shown below: $paged = ( get_query_var( ‘paged’ ) ) ? get_query_var( ‘paged’ ) : 1; $args = array( ‘posts_per_page’ => 4, ‘paged’ => $paged, ); $the_query … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)