Archived topic
Featured Image caption appearing on homepage/ sidebar images
7 replies · Started by victor on November 14, 2022
Hello,
How can I disable the featured image caption from appearing there? I want it to appear on posts only. I don't want the caption to appear area like this 👉 https://ibb.co/0tGPCcZ
Hi Victor,
By default, the Featured image caption shouldn't be appearing.
For reference, can you provide the link to the site in question?
You may use the Private Information field for this: https://docs.generatepress.com/article/using-the-premium-support-forum/#private-information
Hi, click on any post on twendesasa.com and peep on the side bar widget..you will see the copyright caption appearing too.How can I fix this?
This is the code on the snippet.
add_action( 'post_thumbnail_html', 'db_auto_single_featured_caption', 10 );
function db_auto_single_featured_caption( $html ) {
$caption = get_the_post_thumbnail_caption();
if ( is_single() && !empty($caption) ){
$html .= '
';
}
return $html;
}
Hi there,
simplest fix would be to hide it with some CSS:
aside .wp-show-posts-image .wp-caption {
display: none;
}
Thank you.
You're welcome
tried adding the css to stavica.com..seems like the captions are still appealing on the homepage. any fix?
Update: Figured it out.
Glad to hear that!