Posts page isn't displaying posts
-
I’m creating my own theme, based on the Starkers starter theme. I have static home page and I want my posts to appear on the “episodes” page (this is for a podcast site).
I have created an “episodes.php” template, based on Starkers’ index.php file. On the edit page for “episodes” I have selected the “episodes” page template.
Under settings > reading, I have selected “front page displays” “a static page” and selected the home template for the static page. I also selected “episodes” for the posts page.
I have no idea why this isn’t working. The episodes page is not pulling in articles.
Here is the code for the episodes.php template;
<?php /* Template Name: Episodes */ ?> <?php Starkers_Utilities::get_template_parts( array( 'parts/shared/html-header') ); ?> <section class="episodes"> <div class="container clearfix episode-tile-container"> <?php if ( have_posts() ): ?> <ol> <?php while ( have_posts() ) : the_post(); ?> <li> <article class="episode-tile clearfix"> <div class="episode-image"> <?php the_post_thumbnail(); ?> </div> <div class="episode-details"> <span class="episode-number">Episode <?php echo get_post_meta($post->ID, 'episode-number', true); ?></span> <time class="episode-date" datetime="<?php the_time( 'Y-m-d' ); ?>" pubdate><?php the_date(); ?></time> <h3><a href="<?php esc_url( the_permalink() ); ?>" title="Permalink to <?php the_title(); ?>" rel="bookmark"><?php the_title(); ?></a></h3> <?php the_content('[...]'); ?> </div> </article> </li> <?php endwhile; ?> </ol> <?php else: ?> <h2>No posts to display</h2> <?php endif; ?> </div> </section> <?php Starkers_Utilities::get_template_parts( array('parts/shared/html-footer') ); ?>
The episode title should be displayed in the <h3> tag. However, the <h3> displays “Episodes”, which is the title of the page. It seems to be trying to display page content, rather than loop through articles.
I’ve tried a fresh install of WordPress, and creating a fresh database. Nothing seems to work. This is driving me a bit bonkers…
Can anyone help?
Thank you in advance.
- The topic ‘Posts page isn't displaying posts’ is closed to new replies.