Hi Pascal;
Did a quick test, adding this;
function my_scripts_method() {
wp_enqueue_script( 'scriptaculous' );
}
add_action( 'wp_enqueue_scripts', 'my_scripts_method' );
to the functions.php of my testblog and can’t reproduce I’m afraid.
Although 1.9.3 featured a change in how Autoptimized hooked into wordpress (at init instead of template redirect, with another priority as well), this was reverted the next day in 1.9.4, so I would have no idea what would cause this behaviour (which would mean almost no scripts would be added to your page, as every plugin and theme is bound to use that function).
What I would propose in order to identify the reason for this erratic behavior;
* keep AO active and disable your other plugins (and maybe briefly swith to another theme as well)
* check you phperror-log for relevant information
* consider rolling back to AO 1.9.2 (download here) to see if this indeed would solve the problem
* if your code differs substantially from the one above (which I copy/pasted from the codex.wordpress.org), then post a (minimal) example here for me to test against.
Looking forward to cracking this little mystery! 😉
Kind regards,
frank
Hi Frank,
thank you very much for your quick response. I’m using this as base for my themes: https://github.com/pascalbajorat/WordPress-Boilerplate/blob/master/functions.php
And the function “FrontendScripts()” will not be called when I activate AO.
I will try it with version 1.9.2, maybe you have an idea so far.
Thank you and kind regards
Pascal
Morning Pascal,
Did some tests with that code, bringing it to the essenstial;
class WordPressBoilerplate{
static $ver = '2.0.0';
function __construct(){
add_action( 'wp_enqueue_scripts', array(__CLASS__, 'FrontendScripts') );
}
public static function FrontendScripts(){
wp_enqueue_script( 'jquery' );
wp_register_script('wp-h5bp-plugins', get_stylesheet_directory_uri().'/js/plugins.js', array('jquery'), self::$ver, true);
wp_register_script('wp-h5bp-main', get_stylesheet_directory_uri().'/js/main.js', array('jquery', 'wp-h5bp-plugins'), self::$ver, true);
wp_enqueue_script('wp-h5bp-plugins');
wp_enqueue_script('wp-h5bp-main');
}
}
$WordPressBoilerplate = new WordPressBoilerplate();
I have no problem getting this to work both with and without Autoptimize.
Maybe stating the obvious, but do take into account that you won’t actually see the seperate JS-files being called when AO is active, as AO will aggregate all JS-files into one minified “autoptimize_xyz.js”-file?
Have a nice sunday!
frank