wp_enqueue_scripts not working with autoptimize
-
Hi everyone,
I’ve installed autoptimize for WP 4.6.1 and it works great. However, I’ve noticed some scripts stopped working. All script contained in my scripts.php file are not being loaded anymore:
scripts.php
<?php function scripts() { wp_enqueue_script('placeholder-effect', get_bloginfo('template_url') . '/dist/js/placeholderTypewriter.js',array('jquery') , null, true); wp_enqueue_script('slick-js', '//cdn.jsdelivr.net/npm/[email protected]/slick/slick.min.js',array('jquery', 'main') , null, true); wp_enqueue_script('match-height', get_bloginfo('template_url') . '/dist/js/matchHeight.js',array('jquery', 'main') , null, true); wp_enqueue_style('slick-css', '//cdn.jsdelivr.net/npm/[email protected]/slick/slick.css'); wp_localize_script('main', 'MyAjax', array('ajaxurl' => admin_url('admin-ajax.php'))); wp_enqueue_script('main', get_template_directory_uri() . '/dist/js/all.js',[] , null, true); } add_action('wp_enqueue_scripts', 'scripts');
this script is loaded from the wp_head(). However none of the scripts loaded with wp_enqueue_script are working. So here, MyAjax remains empty, and is breaking my ajax calls, all the sliders based on slick are breaking on the site and so on..
What is the workaround to make it work?
Any help is much appreciated thank you.EDIT:
You can have a look at the dev version: https://acceptance-mobiskill.numeria-communication.com/
Viewing 14 replies - 1 through 14 (of 14 total)
Viewing 14 replies - 1 through 14 (of 14 total)
- The topic ‘wp_enqueue_scripts not working with autoptimize’ is closed to new replies.