• pinesandpalmettos

    (@pinesandpalmettos)


    My Site: http://www.pinesandpalmettos.com/

    Post with featured image: http://www.pinesandpalmettos.com/2015/04/that-just-happened/

    I haven’t been using featured images, only inserting photos into my posts. But I would like to start. However I am having some issues, the biggest one being that I do not see the featured image’s caption within the post.

    I have only done featured images on two posts, because I don’t want to commit until I understand this issue (which is why I listed my link plus a link to a specific posts).

    Does anyone know why the caption isn’t showing, or what I could do to fix this?

    Oh and I am using a child theme. Thanks!

Viewing 1 replies (of 1 total)
  • Hi

    First of all great to know that you are using a child theme.

    To add the caption below the featured image, you would need to add some custom code.

    You can replace code from file content-single.php line number 20 which reads

    <?php if ( (has_post_thumbnail()) && ( get_theme_mod( 'athemes_post_img' )) ) : ?>
    		<div class="entry-thumbnail">
    			<?php the_post_thumbnail(); ?>
    		</div>
    	<?php endif; ?>

    to the following

    <?php if ( (has_post_thumbnail()) && ( get_theme_mod( 'athemes_post_img' )) ) : ?>
    		<div class="entry-thumbnail">
    			<?php the_post_thumbnail(); ?>
    		</div>
    		<?php $caption = get_post( get_post_thumbnail_id() )->post_excerpt; ?>
    		<div class="image-caption"><?php echo $caption; ?></div>
    	<?php endif; ?>

    Now make the necessary style changes to make this look the way you want.

    Hope it helps!!

    Thanks

Viewing 1 replies (of 1 total)

The topic ‘Caption on Featured Image’ is closed to new replies.