Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1442812
    #1442837

    Hey williamslyd,
    Can you explain more about what you would like to achieve, a caption under the featured image, or over the image like a overlay? Perhaps a mockup would help.

    Best regards,
    Mike

    #1442838

    Hi, I’d like a caption under the featured image, like in this image: https://monicadesigns.ca/display-caption-to-featured-image-on-extra-theme-post-page/
    Thanks!

    #1442968

    Hi,
    Thank you for your patience, please try following these steps, first add a caption to your featured image in the media library:
    Enfold Support 5746
    Then add this css to your child theme stylesheet or the theme option Quick CSS:

    .single-post .single-big a:after {
        content: attr(title);
    }

    and the caption should show like this:
    Enfold Support 5748

    Best regards,
    Mike

    #1442979
    This reply has been marked as private.
    #1442998

    Hi,
    Thanks for the feedback, remove the css above and keep the caption in your featured image in the media library, and then try adding this code to the end of your child theme functions.php file in Appearance ▸ Editor:

    function custom_post_featured_image_link( $image_link ) {
    	if(is_single() && has_post_thumbnail()) {
    		$image_link = get_the_post_thumbnail();
    		$thumbnail_id = get_post_thumbnail_id();
    		$thumbnail_caption = wp_get_attachment_caption($thumbnail_id);
    		$caption_div = '<div class="featured-image-caption" style="text-align: center;">' . esc_html($thumbnail_caption) . '</div>';
    		$image_link = $image_link . $caption_div;
    	}
    	return $image_link;
    }
    add_filter( 'avf_post_featured_image_link', 'custom_post_featured_image_link', 10, 3 );

    the caption should show like this:
    Enfold Support 5752
    I’m not sure how it will show for your different layouts as the WordPress login above didn’t work for me so I couldn’t test, so give it a try.

    Best regards,
    Mike

    #1443782

    Hi there, that is definately better, but the caption is still not the same width of the image – it is running across the entire width of the page, even if I am using my template that calls for the featured image to be 1000 px max width. See link in private content. Thanks!

    #1443784
    This reply has been marked as private.
    #1443869

    Hi,
    The code above adds a class to the featured image caption called featured-image-caption it looks like you have found this and tried some css to set the max-width, but you have an error with a letter where a number should be: max-width: 1e3px;
    Enfold Support 5799
    I changed it to 900px for you:
    Enfold Support 5801
    Enfold Support 5805
    I see that you tried to add some custom body classes to use some different css:
    Enfold Support 5803
    but I don’t see this on the frontend and I’m not sure how you are doing this, but this is a good approach.

    Best regards,
    Mike

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