Return featured image in query based on Meta Box custom field 'Post'

Hi everyone!

I’m wondering how I can return the featured image of a post that is set in a custom field ‘Post’ that is inside of a ‘Group’.

I managed to return the title of the post and Bricks automatically adds a hyperlink to the post. But now I want to get the Featured Image, so I can use it in the same DIV where the query runs in.

This is the current situation:

Simply adding ‘{mb_page_group_wkvgwsibekq_post_w2njv8tip0d}’ to the dynamic field of the image property does not work.

I tried doing it based on the ID of the post, but I also can’t manage to grab the ID from the post inside the Bricks editor. I tried using this Meta Box article: Post - Meta Box Documentation but all the returned was nothing.

The group looks the following:


The featured image should be grabbed from the post that I selected. This makes updating a product image super easy without me having to edit a bunch of pages.

Thanks for helping!

I got it all working by writing my own function and using

	$loop_object = \Bricks\Query::get_loop_object();
	$post_id = reset($loop_object);

Took me hours to figure it out, but using this I can write very strong functions that grab the fields I want for a post that I selected using a Meta Box custom field ‘Post’.

Hello Jannick,

Would you mind sharing how you specifically achieved this?

I’m using repeaters with a post object ID field and I cannot figure out how to callback the post featured image in a query loop. Are you using the standard image widget with dynamic data set to the repeater field (for example mine is {acf_asc_mats_asc_mat} )?

I would appreciate the help as this has been a major roadblock for my project. :slight_smile:

Hi Monia

see my answer in your other posting.

To get the featured image, just use

{featured_image}

in the image settings inside the image element in the repeater:

Rep7

Cheers

Patric