Tags interfering with 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

Add anchor tag on previous_image_link / next_image_link

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

show previous/next post orderer by title in custom post types

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

Next page link via the custom menu

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