Get next and prev item from custom WP_Query and Custom Post Type

Are you maybe looking for something like this? /** * Outputs blog / archive pagination * */ function my_pagination(){ global $wp_query; $total_pages = $wp_query->max_num_pages; if ($total_pages > 1): $current_page = max(1, get_query_var(‘paged’)); echo paginate_links(array( ‘current’ => $current_page, ‘total’ => $total_pages, ‘prev_text’ => ‘Prev’, ‘next_text’ => ‘Next’, ‘type’ => ‘list’ )); endif; } Then include it … Read more

Custom Permalink For Custom Post Type – Working Fine But Broken For Pagination

// change in post type argument register_post_type( “rewrite” => [ “slug” => “songs/%singer%”, //change in taxonomy argument “with_front” => true ]); register_taxonomy( ‘rewrite’ =>false’, ‘with_front’ => true, ‘query_var’ => true, ‘Custom Rewrite Slug’ => ”); // for add rewrite rule function so23698827_add_rewrite_rules( $rules ) { $new = array(); $new[‘songs/([^/]+)/(.+)/?$’] = ‘index.php?songs=$matches[2]’; $new[‘songs/(.+)/?$’] = ‘index.php?singer=$matches[1]’; return … Read more