Pages within Pages and CSS continued

I was not able to reply to my earlier post so I had to start a new topic…

Hi Dimitry,

Thanks for posting! Unfortunately, we’re not able to get around that issue at this time. Let me try to explain…

The Page Builder only loads in the necessary CSS/JS that it needs for a given post when that post is part of the main WordPress loop. That is because we can use the main loop to see what posts will be on the page before the page is rendered.

When a widget is placed on the page to show a post, it is creating a secondary loop that runs while the page is being rendered and after we’ve inserted any necessary styles into the header. So, the styles needed for your widget won’t be available since we couldn’t possibly know about them before the page started rendering.

The reason we do it this way is to keep the pages on your site from getting bloated with unnecessary stylesheets and scripts like with other plugins. The Page Builder doesn’t just load in the complied CSS/JS for a page, it also loads in other required CSS/JS for things like the content slider or accordion modules if you have them active on your page. If you don’t, it doesn’t load in that CSS/JS. If we made everything global, we would have to load in a lot of code on every page request!

We would like to find a solution for those, but so far, we haven’t been able to come up with anything that isn’t a hack. Can you send me a link to the page with the sidebar you are currently working on? I would love to see more about this use case. Thanks!



I really like this plugin and think that is the most end user-friendly one out there. The site (dev) for my desired implementation is, feel free to check it out.To answer some of your concerns, technically speaking, the pages would not get bloated, since the css/js for the sidebar needs to be loaded for every page anyway because it is common to all the pages. In the current implementation, I added a loop to the sidebar template to query for that specific “sidebar” page:

<?php $side = new WP_Query("pagename=sidebar"); while($recent->have_posts()) : $side->the_post();?>

The way I envision making this plugin better is to add a “global” option where the css/js would become available on every page. I am doing this for the css now by importing the generated file into my theme css:

@import url("…/…/uploads/fl-builder/62-1400186873.css");

This workaround would actually work permanantly for my installation, but the file name changes on every update, so I would have to update the above every time I make a change to that sidebar page. Is it possible not to change the file name of the css file, but to overwrite? Do you have other ideas on how this can be solved?


Hi Dimitry,

Sorry about that and thanks for the follow up!

You have sparked an idea as to how I could make this work. Would you be fine if I added a filter to the builder that allowed you to specify a post or posts that would have their assets loaded globally? I’m not sure I want to add this to the interface but I’d be more than happy to add it to the code. Let me know what you think.


Hi Dimitry,

We went ahead and implemented the solution I mentioned above. It will be documented and included in the next update that should be available in the next few days. You will be able to use that filter like this…

function my_global_builder_posts($post_ids) {
    $post_ids[] = '468';
    return $post_ids;

add_filter('fl_builder_global_posts', 'my_global_builder_posts');

Let me know if you have any questions!


Hi Justin,

I don’t think that I need the graphic interface changed, at least not right now. If I’m reading your code correctly, I would just enter the page ID’s into the array and the assets for those pages (only one in this case) would become global. Would I still need to import the fl builder css into the main file?

Thanks for the response and support, I really appreciate this. This will give my client the possibility of modifying the sidebar page without having me rename the files every time.


Hi Dimitry,

You’re welcome! I’m happy to help.

Yes, you wouldn’t need to import the main CSS file for that page as the builder will load it globally when using that filter. All you need to do is include the specific post id(s) as you mentioned and you’ll be good to go.

I’m glad to hear that is going to help! I’ll try to have that out asap.


Thanks for the plugin update, works great. Thanks.