Pagination stopped working after assigning custom page template to new page (different slug)

1 month ago 23

I americium having a occupation with pagination connected 1 of my CPT aft assigning the customized leafage template to a antithetic leafage with a antithetic slug. It each worked perfectly connected the trial leafage I developed it with. Only aft the caller duty did I tally into this contented for consequent pages (2,3,etc.). Page 1 inactive works fine. I did resave the Permalinks successful WP aft the duty of the customized leafage template and cleared and rebuild each caches (WP Rocket, WP Engine, Cloudflare).

I besides tried modifying the CPT by removing 'hierarchical' => existent and 'capability_type' => 'page' but that did look to person immoderate effect either.

I americium definite I americium missing clearing thing determination arsenic it was moving perfectly earlier the template reassignment.

You tin spot the moving 1 present (click connected '2' beneath the pictures): https://totalk9focus.com/test-page/ You tin spot the non-working 1 present (click connected '2' beneath the pictures): https://totalk9focus.com/client-pictures/

I anticipation idiosyncratic tin assistance maine benignant this out.

Attached codification sections: Definition of the CPT successful functions.php | Query for the pages | Footer conception with pagination links

register_post_type( 'pictures', array( 'labels' => array( 'name' => __( 'Pictures' ), 'singular_name' => __( 'Picture' ) ), '_builtin' => false, 'public' => true, 'show_ui' => true, 'show_in_nav_menus' => false, 'menu_position' => 6, 'hierarchical' => true, 'capability_type' => 'page', 'menu_icon' => ( version_compare( $GLOBALS['wp_version'], '3.8', '>=' ) ) ? 'dashicons-format-image' : '', 'rewrite' => array( 'slug' => 'client-pictures', 'with_front' => FALSE, ), 'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'custom-fields', 'post-formats' ) ) ); } add_action('init', 'my_post_type_client_pictures'); ``` **Query for the pages** ``` get_header(); /* Get Pictures */ $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array( 'post_type' => 'pictures', 'post_status' => 'publish', 'orderby' => 'publish_date', 'order' => 'DESC', 'posts_per_page' => 12, 'paged' => $paged, ); $arr_posts = caller WP_Query( $args ); ``` **Footer conception with pagination links** ``` $total_pages = $arr_posts->max_num_pages; if ($total_pages > 1){ $current_page = max(1, get_query_var('paged')); echo paginate_links(array( 'base' => get_pagenum_link(1) . '%_%', 'format' => 'page/%#%/', 'current' => $current_page, 'total' => $total_pages, 'prev_text' => __('« prev'), 'next_text' => __('next »'), )); } ```
Read Entire Article