• Resolved yourwellnessnerd

    (@yourwellnessnerd)


    Hi there, thank you for such a wonderful theme.

    I am in the process of building a new blog and was hoping to have a caption show up under the feature image in each post.

    Is this possible?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hi there,

    Thank you for getting in touch with us.

    To show up caption under featured image on single post you need to replace this line in single.php file:

    <div class="entry-thumb"><?php the_post_thumbnail( 'full', array( 'alt' => get_the_title(), 'class'=>'img-responsive' ) ); ?></div><?php }

    with this:

    <div class="entry-thumb"><?php the_post_thumbnail( 'full', array( 'alt' => get_the_title(), 'class'=>'img-responsive' ) ); ?><?php echo '<div class="entry-thumb-caption">' . get_post(get_post_thumbnail_id())->post_excerpt . '</div></div>';

    Kind regards

    Thread Starter yourwellnessnerd

    (@yourwellnessnerd)

    Thank you for the swift reply, it’s much appreciated.

    When I replace the previous code with the new one it makes the blog posts unresponsive.

    Have I done it correctly? This is a direct pull from my .php file with other code above and below. Hope this makes sense.

    Thank you again.

    http://yourwellnessnerd.com/wp-content/uploads/2018/12/Screen-Shot-2018-12-13-at-3.55.34-PM.png

    Sorry, I forgot about closing curly bracket. Please replace the code above with this:

    <div class="entry-thumb"><?php the_post_thumbnail( 'full', array( 'alt' => get_the_title(), 'class'=>'img-responsive' ) ); ?><?php echo '<div class="entry-thumb-caption">' . get_post(get_post_thumbnail_id())->post_excerpt . '</div></div>';}

    Kind regards

    Thread Starter yourwellnessnerd

    (@yourwellnessnerd)

    Brilliant, many thanks for taking the time to help!

    While I have you, is it also possible to change the line spacing of the text in posts? I’d like to have a little more space between each line and paragraph.

    Only a pleasure πŸ™‚

    To add more space on single post page you need to add this code to Appearance β†’ Customize β†’ Additional CSS field:

    .single-content {
        line-height: 1.7em;
    }
    /* and here is the space between paragraphs */
    .single-content p, .single-content ul, .single-content ol {
        margin-bottom: 21px;
    }
    

    Hope that helps.

    Kind regards

    Thread Starter yourwellnessnerd

    (@yourwellnessnerd)

    Great thanks again! you guys do a great job with supporting your users

    Thread Starter yourwellnessnerd

    (@yourwellnessnerd)

    Sorry to bother you again, is there a way to change the font size of the caption, make it italic and add a hyperlink?

    Thanks again

    No probs. πŸ™‚

    This should make it italic and feel free to change px value of the font size:

    .single-post .entry-thumb-caption {
    	font-style: italic;
    	font-size: 18px;
    }

    The code applies to captions on posts only.

    Captions could be hyperlinked by following this tutorial – https://wpsites.net/wordpress-tips/how-to-add-html-links-in-wordpress-image-captions/

    Hope this helps.

    Kind regards.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Caption for feature image’ is closed to new replies.