Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1016613

    Hi,

    I’m creating a way for my users to submit pictures on the frontend, and when I’m trying to enqueue the scripts for the WordPress Uploader the are not loaded. I’m using wp_enqueue_media() and the same function works fine in the “Twenty Seventeen” theme

    So something in you code are blocking the enqueue of scripts, like plupload and so on. Any ideas what ?

    #1016616

    Hey Mortenrv!

    The Media script is deactivated by default since Enfold 4.4.x (to increase the loading performance). You can add this code to your 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 on your website (also see: https://kriesi.at/support/topic/enfold-deregistering-wordpress-core-script-style-wp-mediaelement/ ).

    You also need to modify the functions.php file of the parent theme – this customization won’t be necessary with the next theme update (see: https://kriesi.at/support/topic/wp_enqueue_media-not-working-on-frontend-after-latest-update/#post-993991 ). Open up the parent theme functions.php (enfold/functions.php) and replace

    
    $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 );
    

    Cheers!
    Peter

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.