Multiple next / previous
You should try Ambrosite Next/Previous Post Link Plus. It gives you the option of displaying multiple next or previous links among a number of other great options.
You should try Ambrosite Next/Previous Post Link Plus. It gives you the option of displaying multiple next or previous links among a number of other great options.
customize urls displayed by previous_post_link and next_post_link
query_posts() should not be used, look into pre_get_posts hook. Whatever you do inside index.php template does not influence inside of single.php template. Two different top level templates aren’t (normally) loaded at the same time. You are explicitly requesting next_post_link() to limit next post to the same category via third argument, are you sure that’s not … Read more
Next Post Link in format
previous_posts_link returns null when querying custom post type
From next_posts_link: Add the $max_pages parameter to the next_posts_link() function when querying the loop with WP_Query. To get the total amount of pages you can use the ‘max_num_pages’ property of the custom WP_Query object. next_posts_link( ‘Next →’, $connected->max_num_pages );
i’m usig the code for create a link (next and prev) $attachments = array_values( get_children( array( ‘post_parent’ => $post->post_parent, ‘post_status’ => ‘inherit’, ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’, ‘order’ => ‘ASC’, ‘orderby’ => ‘menu_order ID’ ) ) ); foreach ( $attachments as $k => $attachment ) : if ( $attachment->ID == $post->ID ) break; endforeach; … Read more
If you use a filter like the following to adjust the order of a post type archive, then the next & previous links will work perfectly without need for modification: function wpse_139866_set_order_by( $wp_query ) { if ( ! is_admin() && $wp_query->is_post_type_archive( ‘my_post_type’ ) && $wp_query->is_main_query() ) { $wp_query->set( ‘orderby’, ‘title’ ); } } add_action( ‘pre_get_posts’, … Read more
using next-page and previous page inside a wp_query
It turns out i solved the problem by renaming my Staff template from archive-staff.php to page-staff.php (or anything else for that matter), thus specifically telling WordPress not to trust the template hierarchy logic and to consider that url as a “page” url, not a custom post type archive. If you happen to have a use … Read more