How would it be possible to revise the following script, so that an image from a created custom field is displayed, rather than from the default header image (which is set by a featured image)? Could I do something like this and make it work: ($post->ID, ‘header-image’, true)?

I’ve tried to setup a custom field called header-image but would like guidance on how to properly script it.

<?php
if ( has_post_thumbnail() && ! post_password_required() ) :
    $featuredimage = wp_get_attachment_image_src(get_post_thumbnail_id( $post->ID ), 'resonar-large' );
?>
<div class="entry-header-background" style="background-image:url(<?php echo esc_url( $featuredimage[0]

Read more here: Getting image from custom field not default header image (featured image)


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: