Add custom heading over featured image?

Is there a way to do this? I want to add a headline over each individual featured image on each page. Is there a way to add a page attribute for this or do I have to just put the <h1> in the page content and absolutely position it with CSS?

Hi @iconiq,

I hope you are well today and thank you for your question.

You can achieve this by using the attached small plugin that contains the following code.

function modify_post_thumbnail_html($html, $post_id, $post_thumbnail_id, $size, $attr) {
    if( is_page() && !empty($html) ){
    	$head_line = get_post_meta( get_the_ID(), 'page_headline', true );
    	$html = '<h1>'.$head_line.'</h1>'.$html;
    return $html;
add_filter('post_thumbnail_html', 'modify_post_thumbnail_html', 99, 5);

To save page head line for each page, just set the custom field having name as page_headline in the page as described on the following page.

Best Regards,