Pagination: How do I always show ‘previous’?

Looking at the source of paginate_links() it seems there is no option available to always include a previous or next link. The function simply compares the current page number with the total page number to determine whether these links need to be added. Working around this problem is possible, though. This should get you started: … Read more

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

Short answer: Try ‘base’ => str_replace( $big, ‘%#%’, esc_url( get_pagenum_link( $big ) ) ), ‘format’ => ‘?paged=%#%’, Long answer: I took a look at the paginate_links() source code (v3.5.1) and there is this line (#) $link = str_replace(‘%_%’, 1 == $n ? ” : $format, $base); that is giving you the empty first page link. … Read more

Implementing a general Table of Content across single paginated post pages

Just inspect the current post content for <!–nextpage–>: function wpse_check_multi_page() { $num_pages = substr_count( $GLOBALS[‘post’]->post_content, ‘<!–nextpage–>’ ) + 1; $current_page = get_query_var( ‘page’ ); return array ( $num_pages, $current_page ); } On page 2 of 3 that returns: Array ( [0] => 3 [1] => 2 ) On an unpaged post it returns: Array ( … Read more

Display “Page 3 of 5” for a paginated post

The current / total page count is set up by setup_postdata() which runs at the beginning of the loop. So, if you’re in the loop, all you have to do is this: global $page, $numpages; echo “Page $page of $numpages”; If you need to do that outside of the loop, do this first: global $page, … Read more

How to fix pagination after rewriting url? ie. www.site.com/players/type/pro/page/3/

You have to add another rule which maps the /page/# to the &paged=# variable. Really though, you’re kinda doing it all backwards here by filtering the rules array. Just calling add_rewrite_rule to add your rules makes a bit more sense. function plugin_name_add_rewrite_rules() { add_rewrite_rule(‘players/type/([^/]+)/?$’, ‘index.php?post_type=players&type=$matches[1]’, ‘top’); add_rewrite_rule(‘players/type/([^/]+)/page/([0-9]+)?$’, ‘index.php?post_type=players&type=$matches[1]&paged=$matches[2]’, ‘top’); } add_filter(‘init’, ‘plugin_name_add_rewrite_rules’);

post pagination names, not numbers

The text for <!–nextpage–> is hardcoded, so you can’t modify that specifically. wp_link_pages only works with consistent text, so I don’t think you can really make that do exactly what you want either, but it does accept a parameter echo which you can set to false to return the value. Leveraging that, there are plenty … 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

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