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.