I was not able to reply to my earlier post so I had to start a new topic…
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 newmoquinpress.com, 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:
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?