Between my phone and work some errors creeped in, sorry about that. here is my revised answer. Hope this helps in solving your problem.
PROBLEM 1
You should not name your template ‘archive-{$post_type}.php’ if it is a page template. This totally goes against the template hierarchy for pages, and that is why your static frontpage doesn’t work. From the codex
A static page: WordPress uses the Static Page template hierarchy: Custom Page Template, page-{id}.php, page-{slug}.php, page.php, index.php
SOLUTION TO PROBLEM 1
You should consider names like front-page.php which is the appropriate name for a frontpage template or something like page-podcasts.php which falls within the hierarchy for page templates. archive-{$post_type}.php is exclusively used for archive pages of custom post types. Consider having a look at Theme Developments as well
You can remove the pre_get_posts
function as this will not be necessary anymore if you change your template name.
PROBLEM 2
When using WP_Query
to create a custom query, and you need pagination, you will need to make use of the pagination parameters within WP_Query
. This parameter differ for static front pages. Where paged
is usually used, front pages make use of page
page (int) – number of page for a static front page. Show the posts that would normally show up just on page X of a Static Front Page.
SOLUTION TO PROBLEM 2
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
should be changed to
$paged = (get_query_var('page')) ? get_query_var('page') : 1;
This line in your array that you pass to WP_Query
is correct. No need to change this
'paged' => $paged
PROBLEM 3
Your pagination function should also be adjusted accordingly to your custom query. Two things jump up here for me, your max_num_pages
argument is not set for your custom query, paged
should be page
for frontpage, and you are using the variable $wp_query
. Your variable set for your custom query is $postslist
, so you should adjust your pagination function according to your variable.
SOLUTION TO PROBLEM 3
I came across this ready-made function from @ewroman that combines a custom query and the normal main query into one pagination function, so you will not need to create two functions just for different paginated queries. I’ve tested this with your custom post page and it works great. You can just modify this function even further
if( ! function_exists( 'my_paginate_links' ) ) {
function my_paginate_links() {
global $wp_query, $postslist;
$big = 999999999; // This needs to be an unlikely integer
if ( is_front_page()) {
$myqueryis = $postslist;
$paged = ( get_query_var('page') ) ? get_query_var('page') : 1;
} else {
$myqueryis = $wp_query;
$paged = get_query_var('paged');
}
// For more options and info view the docs for paginate_links()
// http://codex.wordpress.org/Function_Reference/paginate_links
$paginate_links = paginate_links( array(
'base' => str_replace( $big, '%#%', get_pagenum_link($big) ),
'current' => max( 1, $paged ),
'total' => $myqueryis->max_num_pages,
'mid_size' => 5,
'prev_next' => True,
'prev_text' => __('« previous'),
'next_text' => __('next »'),
'type' => 'list'
) );
// Display the pagination if more than one page is found
if ( $paginate_links ) {
echo '<div class="pagination-centered">';
echo $paginate_links;
echo '</div><!--// end .pagination -->';
}
}
}
From what I could see from your pagination function also that I did not mention, your current
parameter seemed to also be the big culprit here
ALTERNATIVE SOLUTION TO PROBLEM 3
You can maybe also have a look at next_posts_link
and previous_posts_link
. Just remember here as well, for custom queries, the $max_pages
parameter in next_posts_link
should be set for pagination to work correctly.
next_posts_link( 'Older Entries', $postslist->max_num_pages );