-
AuthorPosts
-
October 4, 2018 at 4:33 pm #1017958Simon ProsserGuest
Hi there i’m one of the developers for Beaver Builder, its come to our attention that the latest version of your theme throws a javascript fatal error rendering Beaver Builder unusable.
After some digging I was able to get the user up and running again with the snippet found here as an mu-plugin: https://gist.github.com/Pross/a052438fad0bbd48ddee87af675d40d1
Obviously this is not ideal. We are getting new people each day that are seeing this error.
Rolling back the theme version also fixes the issue, so its the latest version of your theme causing the issue.
Please feel free to email me directly if you require any further information.
Free version of Beaver Builder can be found here:
October 4, 2018 at 5:38 pm #1017978Hey Simon,
The media script is deactivated by default since Enfold 4.4.x (to increase the loading performance). The user can add this code to the child theme functions.php:
add_filter( 'avf_enqueue_wp_mediaelement', 'avia_always_load_mediaelement', 10, 2); function avia_always_load_mediaelement($condition, $options) { $condition = true; return $condition; }
to load the media script by default (also see: https://kriesi.at/support/topic/enfold-deregistering-wordpress-core-script-style-wp-mediaelement/ ).
At the moment the user also needs to modify the functions.php of the parent theme – the customization won’t be necessary with the next theme update (will be released next week; also see: https://kriesi.at/support/topic/wp_enqueue_media-not-working-on-frontend-after-latest-update/#post-993991 ). The user needs to replace this code in enfold/functions.php
$condition = !( isset($options['disable_mediaelement']) && $options['disable_mediaelement'] == "disable_mediaelement" ) && av_video_assets_required();
with
$condition = !( isset($options['disable_mediaelement']) && $options['disable_mediaelement'] == "disable_mediaelement" ) && av_video_assets_required(); $condition = apply_filters( 'avf_enqueue_wp_mediaelement', $condition, $options );
Best regards,
PeterOctober 4, 2018 at 5:44 pm #1017980Simon ProsserGuestFurther testing revealed that the condition was always TRUE for the following code, does not matter what is enabled in the admin area, thats why I had to overide the enqueue function.
$condition = !( isset($options['disable_mediaelement']) && $options['disable_mediaelement'] == "disable_mediaelement" ) && av_video_assets_required();
Having the filter means we can set it false when the Beaver Builder is open, when will a new version of that filter be released?
We cant ask our users to edit your theme.
October 4, 2018 at 6:28 pm #1017986Hey!
Having the filter means we can set it false when the Beaver Builder is open, when will a new version of that filter be released?
Yes! The next theme update will introduce the avf_enqueue_wp_mediaelement filter and you can use it to enqueue (or deactivate) the script manually. I’ll also ask the framework developer to add an option to the admin panel.
Further testing revealed that the condition was always TRUE for the following code, does not matter what is enabled in the admin area, thats why I had to overide the enqueue function.
Normally the condition should only return true if the “Disable self hosted video and audio features” theme setting is not activated/checked (Enfold > Theme Options > Performance) or the av_video_assets_required function (defined in enfold\includes\helper-assets.php) doesn’t find a media shortcode in the post/page content. I’ll debug the code and check all possible cases.
Regards,
PeterOctober 4, 2018 at 6:41 pm #1017989Simon ProsserGuestWeve already added the following to our compatibility file which will be released later today in preperation:
/** * Fix for Enfold theme always loading wp-mediaelement * @since 2.1.5 */ add_filter( 'avf_enqueue_wp_mediaelement', 'fl_builder_not_load_mediaelement', 10, 2 ); function fl_builder_not_load_mediaelement( $condition, $options ) { if ( FLBuilderModel::is_builder_active() ) { $condition = false; } return $condition; }
October 4, 2018 at 6:52 pm #1017991Hey!
Awesome thank you. I sent you a mail :)
Cheers!
PeterOctober 4, 2018 at 6:53 pm #1017992Simon ProsserGuestThis reply has been marked as private. -
AuthorPosts
- You must be logged in to reply to this topic.