Tagged: caption, featured image, single post
Is there a way to add captions below the featured image on a single post page?
Hi jenerdman!
What kind of Blog Style do you have for your single post page?
Regards,
Ismael
Single post style with big preview image. You can see a sample page here: http://yourmiweddingvenue.com/stand-out-in-the-wedding-industry/
Hey!
Open up enfold/includes/loop-page.php and replace
<?php if($slider->slidecount) echo $slider->display(); ?>
with
<?php
if($slider->slidecount) echo $slider->display();
$description = get_post_field('post_content', get_post_thumbnail_id());
echo $description;
?>
You can use the “Description” field on the image attachment editor page (Media > Library > Edit) to save a description text.
Cheers!
Peter
that text doesn’t exist in my loop-page.php file?
Hey!
If you aren’t using 2.4.2 make sure to update so that you have the most recent version of the theme files and code.
Best regards,
Devin
OK, I updated the theme but I still don’t see that line in the loop-page.php file??
Hi!
Edit includes > loop-index.php, find this code:
if($slider) $slider = '<a href="'.$link.'">'.$slider.'</a>';
if($slider) echo '<div class="big-preview '.$blog_style.'">'.$slider.'</div>';
Below, add Dude’s code:
$description = get_post_field('post_content', get_post_thumbnail_id());
echo $description;
Edit the images on Media > Library > Edit and put the caption on the Description field of the image.
Best regards,
Ismael
excellent. That worked. I added css styling to it:
$description = get_post_field('post_content', get_post_thumbnail_id());
echo '<div class="featured-caption">' .$description.'</div>';
Is that correct?
Yep, that looks correct.