Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #182358

    Is there a way to add captions below the featured image on a single post page?

    #182774

    Hi jenerdman!

    What kind of Blog Style do you have for your single post page?

    Regards,
    Ismael

    #182805

    Single post style with big preview image. You can see a sample page here: http://yourmiweddingvenue.com/stand-out-in-the-wedding-industry/

    • This reply was modified 11 years ago by jenerdman.
    #183670

    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

    #184157

    that text doesn’t exist in my loop-page.php file?

    #185041

    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

    #185089

    OK, I updated the theme but I still don’t see that line in the loop-page.php file??

    #185461

    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

    #185747

    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?

    #186494

    Yep, that looks correct.

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘Featured Image Captions?’ is closed to new replies.