Skip to main content
Skip to article

Metabox gallery support snippet

352 views
<?php 

add_filter( 'bricks/posts/query_vars', function( $query_vars, $settings, $element_id ) {
    
  
// Adjust the element ID based on your the Query Loop element
if ( $element_id == 'ehotqt' ) {
$query_vars['post__in'] = \Bricks\Integrations\Dynamic_Data\Providers::render_tag( '{mb_products_product-gallery}', $post_id, 'image' );
} 
	
	if ( $element_id == 'rpmswq' ) {
$query_vars['post__in'] = \Bricks\Integrations\Dynamic_Data\Providers::render_tag( '{mb_products_product-gallery}', $post_id, 'image' );
} 


return $query_vars;
}, 10, 3 );

To determine the name of your field for the snippet above, use it inside Bricks, use whatever you see here in the code above, in this case {mb_products_product-gallery}

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how Design with Cracka is funded, why it matters, and how you can support us.
Join the Community
Join over 7000 learners and contributors on Design with Cracka community. Don't miss out on the conversations!
dicecartselectearthcrossarrow-rightlayerstext-align-center