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

add_rewrite_rule – working fine but broken for pagination

Have you tried: The main one: add_rewrite_rule( ‘region/([^/]+)/type/([^/]+)/?’, ‘index.php?taxonomy=region&term=$matches[1]&post_type=$matches[2]’, ‘top’ ); For pagination add_rewrite_rule( ‘region/([^/]+)/type/([^/]+)/page/([0-9]{1,})/?’, ‘index.php?taxonomy=region&term=$matches[1]&post_type=$matches[2]&paged=$matches[3]’, ‘top’ ); Out of curiousity, I replaced one of the ([^/]+) with the literal ‘type’ since that doesn’t seem to be a dynamic variable. If the pagination doesn’t work, try switching the order of when it’s declared, i.e. before … Read more

how to get pagination link url?

If you check out the source, they’re both wrappers around *_posts(), which in turn are wrappers for get_*_posts_page_link() (where the wildcard indicates either next or previous). For example, next_posts() will echo or return the escaped URL, depending on the first argument: $escaped_url = next_posts( false /* Don’t echo */ ); next_posts(); // Prints escaped URL … Read more

Pagination resolving to first page only

Building off of what Rarst has said, I’m pretty sure the query string will retain ‘paged’ queries even if WP_Query strips it out as irrelevant. You could try replacing your query posts line with this: global $query_string; parse_str( $query_string, $my_query_array ); $paged = ( isset( $my_query_array[‘paged’] ) && !empty( $my_query_array[‘paged’] ) ) ? $my_query_array[‘paged’] : … Read more

How to add CSS Class to previous_post_link or get previous/next post link URL

You can use the more native function that is “below” the previous_/next_post_link();: # get_adjacent_post( $in_same_cat = false, $excluded_categories=””, $previous = true ) $next_post_obj = get_adjacent_post( ‘”https://wordpress.stackexchange.com/questions/17218/,”‘, false ); $next_post_ID = isset( $next_post_obj->ID ) ? $next_post_obj->ID : ”; $next_post_link = get_permalink( $next_post_ID ); $next_post_title=”&raquo;”; // equals “»” ?> <a href=”https://wordpress.stackexchange.com/questions/17218/<?php echo $next_post_link; ?>” rel=”next” class=”pagination pagination-link … Read more

Why do you need an unlikely integer in paginating?

Note the get_pagenum_link( $big ): This will create an URL (not a link) based on the number provided in the first parameter. That function is used to get the basic pattern for the URL, and the high integer is used here, because: You must provide an integer as argument. The resulting URL is filtered with … Read more

Paged posts – how to use numbers and next/previous links?

The function you’re using, wp_link_pages­Codex, does not have the feature you’re looking for by default. However you can easily extend it by using a callback function, registered as a filter on that functions arguments: add_filter(‘wp_link_pages_args’, ‘wp_link_pages_args_prevnext_add’); The filter will then modify the parameters that are used in that function on-the-fly and inject the missing links … Read more

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