Hello,
I’d like to show text over featured images for a Custom Post Type, both on single posts and archives, based on a given condition (the slug of a custom taxonomy).
Is there any way to accomplish this with GeneratePress?
I’m experimenting whith WordPress filter “post_thumbnail_html”. As far as I know, WordPress function ‘get_the_post_thumbnail()’ fires this filter, and I think that GP calls this function both from content.php and content-single.php (through ‘generate_before_content’ action hook) , but I only see the expected result on single posts, and not on archives.
This is my test code:
<?php
function modify_post_thumbnail_html($html, $post_id, $post_thumbnail_id, $size, $attr) {
$html .= '<h3>SOME TEXT AFTER FEATURED IMAGE</h3>';
return $html;
}
add_filter('post_thumbnail_html', 'modify_post_thumbnail_html', 99, 5);
?>
What am I missing?
Or otherwise, Is there any other way to accomplish this (print contidional text over or after featured image on any page it appears on) with GP?
Thank you!