Hi to the team !
A small question here ( I hope ^^; ). I am using the documentation’s snippet for using the Layout Builder with any post type and it’s working great :
add_filter('avf_builder_boxes', 'add_builder_to_posttype');
function add_builder_to_posttype($metabox)
{
foreach($metabox as &$meta)
{
if($meta['id'] == 'avia_builder' || $meta['id'] == 'layout')
{
$meta['page'][] = 'post'; /*instead add the name of the custom post type here*/
}
}
return $metabox;
}
But I have several Custom Post Types and I’m not sure how to “queue” all of them in snippet. I believe I have to use an array but I’m not sure how. Could you help me on this ?
Thanks in advance ! Good day to the team !
Fred
Hey FLQA!
Try this out.
add_filter('avf_builder_boxes', 'add_builder_to_posttype');
function add_builder_to_posttype($metabox)
{
foreach($metabox as &$meta)
{
if($meta['id'] == 'avia_builder' || $meta['id'] == 'layout')
{
$meta['page'][] = 'post';
$meta['page'][] = 'products';
$meta['page'][] = 'reviews';
$meta['page'][] = 'recipes';
}
}
return $metabox;
}
Cheers!
Elliott
Hi Elliott!
Perfect, thanks a lot!