Tagged: custom post
I want to add the layout builder to several custom post types I created. I used the function you provided in a tutorial (below) to do it for one, but how would I use this for a few additional custom post types. For example postType1, postType2 and posType3
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;
}
Hey asinger777,
You can use this code instead:
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'][] = 'postType1';
$meta['page'][] = 'postType2';
$meta['page'][] = 'postType3';
}
}
return $metabox;
}
Hope this helps :)
Best regards,
Nikko