Row background image from a custom query

I’m inserting the latest blog post at the top of the home page of a website, and so far I’m using the posts module. However, I’m wanting the featured image of the latest post to be the background image, and the only thing I can figure out how to do is make the featured image of the page I’m on the background image. Any tips for making the featured image of the latest published blog the background of a row?

I have Beaver Builder, the BB theme, and Themer all installed on this site.

Super simple, just select photo as the background type, then select URL then add:
[wpbb post:featured_image size=full display=url] as the url

Looks like that does the current page’s featured image, not the latest published blog article. Is there a way to specify I want the latest blog’s featured image instead?

No, you are going to have to write your own shortcode for that. You should be able to access the posts array in the wp_query global, then use the 1st posts ID to get the thumbnail url.

Ah, bummer, was hoping that already existed. Okay, I’ll put something together and drop it into functions.php. Thanks!

For anyone looking, here’s the code I ended up adding to functions.php, then I was able to put the shortcode [latestFeaturedImage] in for the URL of the image:

// Shortcode to get latest post's featured image
add_shortcode('latestFeaturedImage', 'latest_featured_image');

function latest_featured_image($atts) {
    global $post;
    // Get the post object that's the latest post
    $latest_post = get_posts("post_type=post&numberposts=1");
    // Get the ID of that post
    $latest_post_id = $latest_post[0]->ID;
    // Get the featured image URL of that post, large size
    $latest_post_featured_url = get_the_post_thumbnail_url($latest_post_id, 'large');
    return $latest_post_featured_url;
}

@tandsgo Thank you for sharing your solution!