I have a CPT
of podcast type implemented in my WordPress. I had to do a type 301 redirection since the plugin that manages the podcasts (Seriously Simple Podcasting) did not let me modify the appearance of the archive, so I created a custom one and made the aforementioned redirection of podcasts to podcast.
The code that rescues the published podcasts is:
$args = array(
'post_type' => 'podcast',
'orderby' => 'date',
'order' => 'DESC',
'posts_per_page'=> '1',
'paged' => get_query_var( 'paged' ),
);
$loop = new WP_Query( $args );
if( $loop->have_posts() ):
while( $loop->have_posts() ): $loop->the_post(); global $post;
echo '<div id="podcast_archive">';
echo '<a href="' . get_the_permalink() . '"><div class="img_episode">' . get_the_post_thumbnail( $id, array(200,200) ) . '</div></a>';
echo '<a href="' . get_the_permalink() . '"><h2 class="title_episode">' . get_the_title() . '</h2></a>';
echo '<a href="' . get_the_permalink() . '"><div class="excerpt_episode"><p>' . get_the_excerpt() . '</p></div></a>' ;
echo '</div>';
endwhile;
next_posts_link( 'Older Entries', $loop->max_num_pages );
previous_posts_link( 'Newer Entries' );
endif;
I currently have two chapters published and to prove the paging, I have put each page only contains one episode.
The problem is that when I give Older entries
he gives me a 404 error. The url he tries to get me out is /
.
How could I solve this error in paging? I would not like all episodes to be loaded on the same page.