• The featured images are not showing up for my protected posts with this theme. For all my previous themes they do show up. I really like this theme and don’t want to go through all the hassle of changing theme again, just that this really bugs me. Hope that someone can help resolve this problem, thanks in advance!

Viewing 1 replies (of 1 total)
  • Hi there,

    in Twenty Fifteen the featured image is not showed if the post is protected because it’s created this way. If you want to show the featured image you should create a child theme and add this in the functions.php file of your child theme:

    <?php
    function twentyfifteen_post_thumbnail() {
    	if ( is_attachment() || ! has_post_thumbnail() ) {
    		return;
    	}
    
    	if ( is_singular() ) :
    	?>
    
    	<div class="post-thumbnail">
    		<?php the_post_thumbnail(); ?>
    	</div><!-- .post-thumbnail -->
    
    	<?php else : ?>
    
    	<a class="post-thumbnail" href="<?php the_permalink(); ?>" aria-hidden="true">
    		<?php
    			the_post_thumbnail( 'post-thumbnail', array( 'alt' => get_the_title() ) );
    		?>
    	</a>
    
    	<?php endif; // End is_singular()
    }
    ?>

    Hope this helps.

Viewing 1 replies (of 1 total)
  • The topic ‘Featured image not showing for protected posts’ is closed to new replies.