WordPress does this for you. You shouldn’t need a custom Page template or custom query and pagination.
Just set 'has_archive'
to true
when registering the post type. Then you automatically get /episodes
and /episodes/page/X
.
Then you just need to create archive-afleveringen.php
for the template, and in that template use the functions for the main query:
<?php if( have_posts()) : while( have_posts()) : the_post(); ?>
You also don’t need to create your own query or used paged
at all.
Related Posts:
- Custom post type pagination 404 fix?
- Custom post type archive 404’s with paginate_links
- Pagination throws 404 error on custom taxonomy archive pages
- Pagination throws 404
- Custom Taxonomy archive returns 404
- Pagination gives 404 error
- Pagination with custom post types results in 404 issues
- Help with Elementor Pagination CPT archive 404 problem
- Custom post type pagination 404
- Custom WP_Query always respond with 200 status even when no entry
- Problem with custom loop navigation inside the blog page
- 404 error next-page [2] PageNavi custom type taxonomy
- Pagination in custom loop for custom post type throwing 404 error
- How do I paginate a custom post type listing on a custom template page?
- WordPress custom post type post and category links 404
- Pagination on category pages using wp_pagenavi causes 404 errors
- Custom post type category pages pagination returns 404
- 404 in custom post type feed with mistake permalink
- pagination not working for category.php (custom post types in categories)
- Page not found for custom post type UI plugin and taxonomy
- How to solve this custom post type goes to 404 page?
- Pagination broken by naming conflict between CPT and Page
- Cant get paginations on single.php to work with my custom post types
- Custom post type single page (single-{CPT-name}) 404 when slug includes hyphens
- Problems with 404, .htaccess, permalinks and WordPress custom posts locally on Snow Leopard
- Number of posts in the archive
- 404 Error on form submission within custom post type
- Pagination custom post type not working with rewrite slug
- Pagination Not Working for Custom Taxonomy with Custom Query – 404 Error
- Custom rewrite to fetch feed data
- Pagination Error : Duplicate argument being outputted
- Can’t use pagination with custom taxonomy
- Pagination doesn’t function properly for archive of a custom post type set as the front page
- Trouble with pagination
- Pagination 404 on Index with custom query
- page not found for single-type.php file
- Custom taxonomy page returns 404
- previous_post_link in same taxonomy in custom post type
- How to do admin CRUD & Pagination
- One Custom post type 404’s others don’t
- Custom ordering of CPT items not matching with the ordering of its pagination
- Pagination doesnt work in custom post type
- Custom taxonomy template list not working (404)
- Pagination hitting 404 page on /page/4
- Custom post type permalink returns 404 when set to private
- Custom post type slug 404
- How to filter a custom post type by custom taxonomy without 404
- Break up posts per page in two sections
- Custom Post 404
- Custom post type and custom taxonomy 404 on page 2
- Custom taxonomy template shows 404 Error
- Using Pagination for Custom Post Type and keeps returning 404
- Post type Permalink
- Pagination on search results page
- 404 Page Not Found on /Page/2/ on Tag Page
- How to list custom post types on a custom post type page?
- Custom post type categories gives 404 error
- Pagination for search results of custom post type [duplicate]
- Direct form to a custom page template
- Pagination of custom post type leads to 404 error
- Pagination for custom post types – url rewriting
- Custom Post Type Archive Pagination
- next page with custom post
- Difference between page and paged
- Taxonomy rewrite pagination 404
- All blog posts are not showing up
- Custom post pagination trouble
- Permalink Trouble with custom post types
- Pagination on a page
- Permalinks not working (404) for the ‘item’ post type
- Custom Post Type Pagination on Single.php?
- Safe to throw 404 error in request filter?
- either single-{custom}.php 404’s OR /taxonomy/ 404’s – custom post type and taxonomy permalinks
- Single parent post lists child posts with pagination
- Using custom post type as front home page pagination not working
- Custom Post Type, Pagination and 404s?
- Custom post type pagination error
- 2 custom post type paging in 1 custom taxonomy
- Pagenavi Plugin and Custom Post Type – Multipage results
- Custom Post Type Child Won’t Come Through With Pretty Permalinks
- Previous / Next Links For Custom Post Type Sorted By Meta_Value
- Add pagination to custom single post template
- pagination for custom post type archive page
- get_query_var(‘paged’) return 0 in custom category page
- custom taxonomy pagination 404 error
- Custom archive page for custom taxonomy and pagination issue
- Sticky posts limit query and pagination for a custom post type
- Pagination in custom post type archive.php not working
- Pagination links for custom post type shows correct number of links, but links result in Page not found
- Pagination for custom post type giving 404 error (but only for news page)
- how to skip a CPT element from the pager by custom field
- Custom post type paging return home page
- Pagination not working in custom post type. Help
- Can’t Export Custom Post Types With Export Tool In A Custom Theme
- Custom post type single page 404
- Pagination Not Working When Used With WP_Query() `offset` Property
- Custom Post Type Pagination getting 404 error
- Pagination on custom post type without plugin
- Sudden 404 pages on product category archives
- Numeric pagination custom post type