has_post_thumbnail working for page.php but not single.php
-
Hi, I have a very weird problem with my loop … am using the roots theme that implements Twitter Bootstrap & working on my own website.
I have two identical files for the single pages & single posts that asks if there’s a featured image .. if so it displays it & if not it just displays the title … now it’s working just fine in the page.php but not in the single.php it always displays the container of the featured image even if it’s not set.
& here’s the code
<?php get_header(); ?> </header> <?php roots_header_after(); ?> <?php roots_wrap_before(); ?> <div class="back-contain"> <div id="wrap" class="" role="document"> <div class="container"> <?php while (have_posts()) : the_post(); ?> <?php roots_post_before(); ?> <section class="row page-header"> <?php if ( has_post_thumbnail()) {?> <div class="hero-contain span12"> <?php the_post_thumbnail('featured-thumb'); ?> </div> <?php } else {?> <h1 class="entry-title span4"><?php the_title(); ?></h1> <?php } ?> </section> <section class="page-content row"> <div class="span12"> <?php the_content(); ?> </div> </section> </div> </div> <?php endwhile; /* End loop */ ?> <?php roots_content_after(); ?> <?php get_footer(); ?>
I really have no idea where the problem might be.
Thanks in advance
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘has_post_thumbnail working for page.php but not single.php’ is closed to new replies.