Single Post Featured Image Widget Caption should not be included
cavalierlife opened this issue · 7 comments
- [ x] I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
- [ x] The issue still exists against the latest stable version of Elementor.
Description
When using the Single Post Featured Image Widget to create a single post template, the Caption field doesn't make sense there. It expects text to be input such as "This is my caption". But the whole point of this widget is to be dynamic, and entering anything into the caption field results in the same caption being displayed under every post's Featured Image. I think the caption field should be removed from the widget.
+1 This is an urgent fix… as we use images on the site that require proper attribution (Creative Commons)
Also margin, padding Settings for the caption would be neat so we can position it properly.
Here is a temporary fix using a custom shortcode for anybody in need and with a bit of coding experience.
Put this in your functions.php (best you have a child theme) or use the plugin snippets
function output_featured_image_caption_func( $atts ) {
if ( $caption = get_post( get_post_thumbnail_id() )->post_excerpt )
return '<p class="caption-fix">'.$caption."</p>";
}
add_shortcode( 'output_featured_image_caption', 'output_featured_image_caption_func' );
Now add a shortcode in your single page template and add
[output_featured_image_caption]
To style your caption use custom CSS on the class "caption-fix"
My solution for this:
add_action('elementor/widget/render_content', function( $content, $widget ) {
if ('theme-post-featured-image' === $widget->get_name()) {
$settings = $widget->get_settings();
$caption=get_the_post_thumbnail_caption(get_the_ID());
$content .= '<figcaption class="widget-image-caption wp-caption-text">' . $caption . '</figcaption>';
}
return $content;
}, 10, 2);
need to add in functions.php
and renders image caption
Can anyone provide a solution for dedicated image alt tags? I've been looking for a solution and it looks like Elementor deprecated this function (closed ticket #1053).
My issue is that the same image is used over and over again for "Vehicle Types" block in different pages and I need to have a different item ALT Tag for every page/post the image is used-on for SEO reasons.
This is for a nationwide limo service and on every city page (i.e NYC, Miami, Los Angeles, Chicago, etc..), there is a vehicle fleet gallery and what I need to do is to add the city name either at the beginning or end of alt tag (i.e. Miami limo Service, Chicago Black Car Services, Sprinter Van Hire Manchester).
+1
Hi,
is it possible to add the caption to the respective image of the post widget Pro (elementor-posts-container) as well?
Similar to the example from here: #5770 (comment)
greetingxxx from Germany.