Hi,
I’m embedding page builder pages within other page builder pages using the filter ‘fl_builder_global_posts’ and I’ve found a couple of issues.
- First issue - All posts (pages) were getting registered when I was only trying to register 1. What I found is if I changed the 1.6.0.1 code from:
// Enqueue assets for posts via the fl_builder_global_posts filter.
$post_ids = FLBuilderModel::get_global_posts();
if(count($post_ids) > 0) {
$posts = get_posts(array('post__in' => $post_ids, 'post_type' => 'any'));
foreach($posts as $post) {
self::enqueue_layout_styles_scripts($post->ID);
}
}
// Reset the global post variable.
$post = $original_post;
TO:
// Enqueue assets for posts via the fl_builder_global_posts filter.
$post_ids = FLBuilderModel::get_global_posts();
if(count($post_ids) > 0) {
foreach($post_ids as $post) {
self::enqueue_layout_styles_scripts($post->ID);
}
}
// Reset the global post variable.
$post = $original_post;
I’m not sure what the purpose of this line is, when you already have the post_ids in an array?
$posts = get_posts(array('post__in' => $post_ids, 'post_type' => 'any'));
- Second issue - After making the above change, my page builder layouts are working when the page is embedded, but not all of the styles are being applied. For example, the 2 column layout is being applied, but colors specified for headers are showing the default instead of the chosen color.
Here’s my function used to register the posts:
function my_global_builder_posts($post_ids) {
$post_ids[] = ‘129’;
return $post_ids;
}
add_filter(‘fl_builder_global_posts’, ‘my_global_builder_posts’);
Thanks for your help!