I’ve created a custom module based on Divi’s Blog module. Ever since the 4.10 the module’s grid layout does not work anymore because of the Dynamic CSS feature. When this is enabled Divi basically only loads the required assets when a specific module is used. So if the Divi Blog Module is not in the page the required CSS is not included and my custom module displays bad.
I saw a filter that should force the assets of a default module and used it inside my custom module:
//force the blog assets to be included inside this custom module
function include_module_assets($assets_list) {
return ['et_pb_blog'];
}
add_filter( 'et_required_module_assets', 'include_module_assets' );
Now this adds some column styles, but the column widths are not being set. So there are still some styles that are not being loaded.
Anybody experienced this yet with their Divi extensions?
Thanks
2
Answers
As there doesn’t seem to be a filter for $grid_items_deps found in ET_Dynamic_Assets::get_global_assets_list you can use the et_global_assets_list filter.
You’ll probably find you need to add_filter earlier than when your module class is initialized, perhaps one level back in the constructor of your extension class.
Hopefully ET adds a filter in the future for $grid_items_deps in the near future. They do seem to be getting a little better with providing filters, still many more could be added.
If anyone knows of a better solution I’d be keen know, as there is an issue with the below that we include gutters3_grid_items.css even when not using a grid layout.
Cheers
Divi dynamic asset loading for custom modules can be quite frustrating.
Always check
Divi/includes/builder/feature/dynamic-assets/class-dynamic-assets.php
for all the required CSS AND JS dependencies.For a custom Blog, first, you have to load the basic dependencies with
et_required_module_assets
filter:Then, for some modules (like Blog), which require grids, you also have to load them with
et_global_assets_list
filter: