Archived topic
GB Version 1.2.0 no Background Image = Featured Image
7 replies · Started by Ian on December 14, 2020
I may have been developing a recently launched site using a beta or alpha version. I was 100% sure that a Block Element had Background Image = Featured Image. Now, an entire site (hero section) no longer display the featured image as a background. I am using GB Version 1.2.0. Did I miss something?
Hi,
I was 100% sure that a Block Element had Background Image = Featured Image.
Block element doesn't have that. Perhaps you're pertaining to Header Element?
https://docs.generatepress.com/article/header-element-overview/
Let us know.
Pretty sure this Element I am looking at is not a Block Element. It's a container with a headline = [PAGE_TITLE] and Type = Block - Hook.
Regardless, also pretty sure when I launched the client site 1-2 weeks ago, all Hero Sections has a featured image. Client really liked this dynamic way to pull the featured image. Now, there is no more featured image in the container background. I may be missing something here. Where can I troubleshoot this?
Is it at all possible that something was removed during the last GB update?
Hi there,
We removed this feature before the actual release on 1.2.0 - we have something better planned :)
Thx Tom. When is the replacement feature coming? Client site is NOT as I had launched it so I may need to fix all pages manually now.
It's never recommended to use alpha versions on production websites, as things can change between alpha/beta and official release.
You can tell the front-end to use the featured image as a background with a filter:
add_filter( 'generateblocks_background_image_url', function( $url, $settings ) {
if ( 'unique-id' === $settings['uniqueId'] && has_post_thumbnail() ) {
return get_the_post_thumbnail_url();
}
return $url;
} );
You just need to update the unique-id with the unique ID of the element. You can find it as an HTML class for the element: .gb-container-unique-id-here
Thanks Tom. Odd, I could not get that snippet to work. I was able to find the unique ID and replaced it inside the functions snippet. Nonetheless, I am going to use a default image for all pages for now. Marking this as resolved.
Strange, you may need to regenerate the CSS after using the snippet so it uses the correct URL.
No problem!