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
- Hierachical Custom post types permalinks not working
- How can i avoid the permalink start with ‘blog’ while using the custom post type?
- Pre get posts for single post
- Pagination not working with custom category template
- Custom Post Type pagination – normal solutions aren’t helping
- Custom Post Type Archives by Date (stored as meta value) WP3.1
- Pagination Doesn’t Work
- Numeric pagination custom post type
- Posts in Multiple Columns and Rows with one single loop
- Removing CPT slug from URL results in 404 error for archive page
- Paginate Custom Post Type Page
- Pagination not working
- Pagination Custom post type
- Pagination Issue: Custom Post Type In Index
- Create second custom 404 page for selected post type
- Custom Permalink with Dynamic Taxonomy for Custom Post Type – Works, but breaks other permalinks
- Order WordPress Custom Taxonomy Pages & Pagination Not Working
- Pagination problem
- Custom post type archive not regarding ‘posts_per_page’ => -1
- Unable to get paginate_links working with a custom query [duplicate]
- Setting posts per page in query_posts
- Custom Post Type + 20k posts = blank/404 within Admin edit.php [duplicate]
- Bizarre Permalinks Issue: 404 Errors Everywhere
- Pagination for custom php code
- How i can add ‘N’ page of ‘N’ pages under posts loop?
- Pagination on a custom post type loop
- Page vs Custom Post Types Differences/Issues
- Wrong request query on cpt and tax
- Custom taxonomy rewrite give pagination 404
- Next and Previous Posts of Same Parent
- Custom template Page 2 not working
- custom post type pagination error 404
- Next Post links not working in custom post type shortcode
- Pagination with custom query, custom search form, single and pages, ajax and no plugins
- Top Level pages in wordpress giving 404, but child pages working fine
- Cant get paginations on single.php to work with my custom post types
- Problems with 404, .htaccess, permalinks and WordPress custom posts locally on Snow Leopard
- 404 Error on form submission within custom post type
- Pagination custom post type not working with rewrite slug
- Can’t use pagination with custom taxonomy
- Pagination 404 on Index with custom query
- Custom taxonomy page returns 404
- Custom ordering of CPT items not matching with the ordering of its pagination
- Break up posts per page in two sections
- How to list custom post types on a custom post type page?
- Custom post type categories gives 404 error
- Direct form to a custom page template
- Custom Post Type Archive Pagination
- Permalink Trouble with custom post types
- Custom Post Type Pagination on Single.php?
- Custom post type pagination error
- Previous / Next Links For Custom Post Type Sorted By Meta_Value
- Custom archive page for custom taxonomy and pagination issue
- Custom post type paging return home page
- Can’t Export Custom Post Types With Export Tool In A Custom Theme
- Custom taxonomy returns 404 even with saving permalinks
- pagination problem listing custom post types of taxonomy in wordpress
- Custom post shows 404 after theme change
- Permalink for custom post type pages not working
- How to display custom post type pagination buttons when processing AJAX request
- Custom post type pagination problem – page 1 and 2 show same content
- New entries to custom post type produce 404 on single view
- Add new custom post type screen (admin area) results into 404
- Custom Post Type Pagination – not displaying posts
- next_posts_link() always generates second page link on custom post type
- Custom 404 redirect for a luddite
- 2 custom posts types, in their own columns, one pagination for both
- Pagination functions won’t work
- pagination for a custom query
- Custom Post Type Rewrite – Page Not Found
- How to Fix Custom WordPress Loop with Pagination on Single Post View?
- why custom post archive gives always no more than 10 posts despite of paging settings?
- Pagination for a Custom Taxonomy
- 404 for children in hierarchical custom post type
- Pagination URL order
- WordPress Load more posts by ajax not working
- Pagination for event query
- Pagination not working for archive
- Archive page – problem with pagination
- Pagination not working in custom post type
- Pagination not working
- 404 Error On Custom Taxonomy Pages 2, 3, etc
- CPT Archive Pagination – Page not found
- the_post_navigation in single page with multiple taxonomies