Support » Fixing WordPress » Unable to change Banner Image on some pages

  • Hey fellow WordPressors,

    I have recently taken over the management of a new website and I am having great difficulty in what should be a very simple task.
    I want to replace the Featured images, but the previous developer has somehow hidden the ability to change the Featured Image on two of the website pages.

    On most of the website pages, I can simply select the desired image using ‘Featured Image’ on the WordPress page. For most of the pages this works as expected. However I have two pages which are defaulting to an ugly image the developer added to the website and I cannot replace it.
    I have trawled through the code, checked every setting, but nowhere can I find where this banner image is selected.

    I have poured over the Customizer with not luck either. The headers are not in Elements and there is no Page Header plugin or Element or Widget installed.

    The developer has created a Child Theme and in the functions.php there is some kind of inner-featured jpg image in play, which is not in my media files. The image does exist in my Media, but not with this title.

    Here is a snippet of the code;

    add_action(‘generate_after_header’,’ss_featured_page_header’,8);
    function ss_featured_page_header(){
    if(!is_front_page()){
    if(is_page()){
    if(has_post_thumbnail()){
    $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), ‘large’ );
    $innerbg = $large_image_url[0];
    } else {
    $innerbg = get_stylesheet_directory_uri().’/assets/images/inner-featured-bg.jpg’;
    }
    } else {
    $innerbg = get_stylesheet_directory_uri().’/assets/images/inner-featured-bg.jpg’;
    }
    $vc_enabled = get_post_meta(get_the_ID(), ‘_wpb_vc_js_status’, true);
    $customheading = get_field(‘custom_page_heading’);
    ?>
    <div class=”inner-featured inner-featured-product”>
    <div class=”inner-featured-bg”<?php if($innerbg){ echo ‘ style=”background-image:url(‘.$innerbg.’);”‘; } ?>>
    <div class=”container”>
    <div class=”inner-featured-title”>
    <h1 class=”page-title”>
    <?php if(is_singular()){
    if($customheading){echo $customheading;} else { the_title(); }
    } elseif(is_search()){
    echo ‘Search’;
    } elseif(is_404()){
    echo ‘Page Not Found’;
    } elseif(is_shop()){
    echo ‘Products’;
    } elseif(is_home()){
    echo get_the_title(get_option(‘page_for_posts’));
    } elseif ( is_category() ) {
    printf( __( ‘Category : %s’, ‘pwd’ ), ‘<span>’ . single_cat_title( ”, false ) . ‘</span>’ );
    } elseif ( is_tag() ) {
    printf( __( ‘Tag : %s’, ‘pwd’ ), ‘<span>’ . single_tag_title( ”, false ) . ‘</span>’ );
    } elseif(is_tax()){
    echo single_term_title(”,false);

    Does anyone have any idea what the developer may have done here, which has locked in this banner image to two of my pages?
    Could it be related to Woo Commerce?

    I know WordPress well, but this one has me stumped!

    Any help would be appreciated.

    • This topic was modified 5 months, 2 weeks ago by Steve Stern.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Steve Stern

    (@sterndata)

    Support Team Volunteer

    I think the key is here:

    if(has_post_thumbnail()){
    $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), ‘large’ );
    $innerbg = $large_image_url[0];
    } else {
    $innerbg = get_stylesheet_directory_uri().’/assets/images/inner-featured-bg.jpg’;
    }
    } else {
    $innerbg = get_stylesheet_directory_uri().’/assets/images/inner-featured-bg.jpg’;
    }

    If a page does not have a featured image, then the image in the theme’s “assets” directory is fetched and displayed.

    On the page you linked:

    See https://i.imgur.com/tozxq1q.png

    Hey Steve,
    I just (10 Minutes ago) replaced the image. Yes, it seems the developer decided to put the image in the Child Theme functions.php file as you suggested. I would have preferred to have added the image via the WordPress or GP interface, but this has done the trick. The problem is, it does not let me override the Background Image with the Feature Image, which is a shame. Anyway, the banner is now changed, so thanks so much for your help.
    All the best

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.