[Resolved] Display Captions on Featured Images only on the post

Home Forums Support [Resolved] Display Captions on Featured Images only on the post

Home Forums Support Display Captions on Featured Images only on the post

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1600599
    _blank

    Hi,

    I used this code suggested by David in one of the questions: https://gist.github.com/diggeddy/5f7c3a4584a8beb51febc9c4f33d6c5c to add captions on the featured images, but the captions are now visible on the front page too, and they are a bit of the place on the posts.

    How can i make the caption be displayed only when someone opens the post?

    #1600607
    David
    Staff
    Customer Support

    Hi there,

    change this line:

    if( $html == '' ) {

    to:

    if( $html == '' || !is_single() ) {

    #1600624
    _blank

    Thanks!

    Could you help me getting the caption text to the left of the image, and make the links on those captions behave the same way as the rest of the links

    #1600915
    David
    Staff
    Customer Support

    First change your link hover CSS to this:

    .entry-content a:not(.button), .featured-image .wp-caption-text a {
        box-shadow: inset 0 -1px 0 currentColor;
        transition: color 100ms ease-in,box-shadow .13s ease-in-out;
    }
    
    .entry-content a:not(.button):focus, .entry-content a:not(.button):hover,
    .featured-image .wp-caption-text a  {
        box-shadow: inset 0 0 0 currentColor,0 3px 0 currentColor;
    }

    And then add this CSS to align the caption left and give it a little space between the image.

    .featured-image .wp-caption-text {
        margin-top: 10px;
        text-align: left;
    }
    #1601335
    _blank

    Thanks, David! You rock!

    Happy New Year!

    #1601489
    David
    Staff
    Customer Support

    You’re welcome

    Happy New Year to you too!

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.