get_query_var(‘paged’) return 0 in custom category page

All of your code can be eliminated by using a pre_get_posts filter: function marco_custom_category_filter( $query ) { // only run this on the main query on category archives if ( is_admin() || ! $query->is_main_query() || ! $query->is_category() ) { return; } $query->set( ‘posts_per_page’, 2 ); $query->set( ‘posts_type’, ‘readings’ ); } add_action( ‘pre_get_posts’, ‘marco_custom_category_filter’ ); With … Read more

Reciving Error 404 blog/page/2/

function wphelp_custom_pre_get_posts( $query ) { if( $query->is_main_query() && !$query->is_feed() && !is_admin() && is_category()) { $query->set( ‘paged’, str_replace( “https://wordpress.stackexchange.com/”, ”, get_query_var( ‘page’ ) ) ); } } add_action(‘pre_get_posts’,’wphelp_custom_pre_get_posts’); function wphelp_custom_request($query_string ) { if( isset( $query_string[‘page’] ) ) { if( ”!=$query_string[‘page’] ) { if( isset( $query_string[‘name’] ) ) { unset( $query_string[‘name’] ); } } } return $query_string; … Read more

Pagination in single.php

Custom loops do not produce pagination like that. You have two options: Use custom archive page and provide custom php template for that (i.e. archive-my_name.php), in this custom template you could provide all other necessary content. Then you could use standard built-in pagination functions https://developer.wordpress.org/themes/functionality/pagination/ Continue in the direction you started, with single.php, but you … Read more

File not found.