How to get post pagination like this

It’s not possible with wp_link_pages(), but you can use paginate_links(). You just need to configure the arguments so that the links are based on the pagination of your post/page. To do this you just need to know: The base URL. This is the permalink of the page/post. The format of the pagination portion of the … Read more

Get next/previous cousin page

I solved this by getting all pages, assigning them by level, and then getting the next page of the same level. If you also want the previous page then you should probably cache the functionality that groups the pages by level. function wpse16875_next_page_same_level_link() { $next_page_same_level = wpse16875_next_page_same_level(); if ( $next_page_same_level ) { return ‘<a href=”‘ … Read more

URL rewrites and pagination

Extending @Stephen Harris’ excellent answer, I would opt for; add_action( ‘generate_rewrite_rules’, ‘my_rewrite_rules’ ); function my_rewrite_rules( $wp_rewrite ) { $wp_rewrite->rules = array( ‘mypageslug/([^/]+)/page/?([0-9]{1,})/?$’ => $wp_rewrite->index . ‘?pagename=mypageslug&user=” . $wp_rewrite->preg_index( 1 ) . “&paged=’ . $wp_rewrite->preg_index( 2 ), ‘mypageslug/([^/]+)/?$’ => $wp_rewrite->index . ‘?pagename=mypageslug&user=” . $wp_rewrite->preg_index( 1 ) ) + $wp_rewrite->rules; } This follows the defacto regex standard … Read more

Secondary loop pagination on custom post type single post gets redirected to first page

I found the answer. I had searched high and low yesterday, but today I finally found it: https://wordpress.stackexchange.com/a/143837/10595 add_action(‘template_redirect’, function() { if ( is_singular(‘posttype’) ) { global $wp_query; $page = (int) $wp_query->get(‘page’); if ( $page > 1 ) { // convert ‘page’ to ‘paged’ $query->set( ‘page’, 1 ); $query->set( ‘paged’, $page ); } // prevent … Read more

WordPress category & taxonomy loop with pagination

Don’t use ‘numberposts’=>-1 because numberposts is depracated moreover -1 shows all the post on one page. Instead use posts_per_page and set its value according to how many posts do you want. $paged= (get_query_var(‘paged’ )) ? get_query_var(‘paged’):1; global $query_string; $myquery = wp_parse_args($query_string); $myquery = array( ‘paged’ => $paged, ‘posts_per_page’=>10, ‘tax_query’ => array( ‘relation’ => ‘OR’, array( … Read more

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