WordPress Website Featured Image Replacement Issue

Im working on my WordPress website, and I’m having an issue with the page template inserting the “Featured Image” at the top of the page. I’ve isolated the PHP code that controls this.

        $thumb = '';
        $width = (int) apply_filters('et_page_image_width',621);
        if ( is_page_template( 'page-full.php' ) || $fullwidth ) $width = (int) apply_filters('et_page_image_full_width', 960);
        $height = (int) apply_filters('et_page_image_height',320);
        $classtext = '';
        $titletext = get_the_title();
        $thumbnail = get_thumbnail($width,$height,$classtext,$titletext,$titletext,false,'Pageimage');
        $thumb = $thumbnail["thumb"];

Now if I delete this code it will remove the image at the top of the page, which is fine but I want to replace it with an image from the media library. Is it possible to change the code so that it pulls the image from the “Edit Page>Custom fields” section in the WordPress page editor?

Read More

Thank you for the help.

Related posts

Leave a Reply

1 comment

  1. add the following:

    if ($thumb) { echo $thumb;} else { echo 'some other image here';}
    

    replace “some other image here” with a new query to get the alternative image.

    hope this helps?