Support » Theme: GeneratePress » Unable to change Banner Image on some pages

  • Resolved twinstar1

    (@twinstar1)


    Hi team,
    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. In most cases I have simply selected the desired image using ‘Featured Image’ on the WordPress page. For most of the pages this has worked. 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.

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

    Any help would be appreciated.

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

Viewing 7 replies - 1 through 7 (of 7 total)
  • Theme Author Tom

    (@edge22)

    Hi there,

    I’m seeing an inner-featured element on the page, which has the image applied as a background image.

    This isn’t a standard GP element, so it’s likely coming from:

    a) A hook. If you’re using Elements (which is premium, so we’re not allowed to support it here), then it would be a Hook Element on your site.

    b) A PHP hook. This would be in your functions.php of the child theme.

    c) A change to a template file. It looks like you’re using a child theme, so maybe there’s a couple template files in the root of the child theme you can check out.

    Hope this helps you find it 🙂

    Hey Tom,
    Thanks for you quick response.
    The site is not using Elements, so I have already ruled that out.

    You are correct and the developer has created a Child Theme.
    I checked the functions.PHP and have identified this code.
    Is it here where I should add a different image, or does this code give you any further clues as to where the setting may be located?

    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);

    Theme Author Tom

    (@edge22)

    Sorry for not getting back to you sooner!

    Do you need that function at all?

    From what I can see, that code is fetching the featured image as the background. If no featured image exists, it will use an image named inner-featured-bg.jpg, which is located in the assets/images folder of your child theme.

    Hey Tom,
    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,
    Troy

    Theme Author Tom

    (@edge22)

    No problem! I suggest checking out our “Elements” module in our premium version: https://generatepress.com/premium#elements

    I think it could be very useful in this case 🙂

    Thanks Tom.
    I will be needing a licence key for my GP as it requires updating. The developer has not given me a licence key, so I will need to purchase it. As it is running a child theme, what is the process? When I purchase the theme from your website, do I also get a licence key which I can add into the Updates field in Appearance > Generatepress?

    Theme Author Tom

    (@edge22)

    Exactly – you’ll receive a key that you can add in that field and you’ll be good to go. Feel free to shoot us an email if you need more info: https://generatepress.com/contact

    Thanks! 🙂

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