"Notice: wp_enqueue_script was called incorrectly" on an old plugin.
-
Hi, I got a lot of errors and I fixed all of them nesting them in a function with a following hook, but now I have this plugin, an old plugin that doesn’t let me do the same thing.
You may say “why an old plugin?”, the answer is “I didn’t find any slideshow gallery plugin that simply transformed a post gallery in a slideshow.I’ve this situation:
public function initialize() { // replace the default [gallery] shortcode functionality add_shortcode('gallery', array(&$this, 'galleryShortcode')); // determine the theme and version for the files to load $theme_js = sprintf("%s/galleria/themes/%s/galleria.%s.js", $this->url, $this->theme, $this->theme); $theme_css = sprintf("%s/galleria/themes/%s/galleria.%s.css", $this->url, $this->theme, $this->theme); $galleria_js = sprintf("%s/galleria/galleria-%s.min.js", $this->url, $this->galleriaVersion); // add required scripts and styles to head wp_enqueue_script('jquery'); wp_enqueue_script('amw-galleria', $galleria_js, 'jquery', $this->galleriaVersion); wp_enqueue_script('amw-galleria-theme', $theme_js, 'amw-galleria', $this->version); wp_enqueue_style( 'amw-galleria-style', $theme_css, array(), $this->version); // admin options page add_action('admin_menu', array(&$this, 'addOptionsPage')); }
If I write this the gallery doesn’t work (inside initialize):
function add_scripts_to() { // add required scripts and styles to head wp_enqueue_script('jquery'); wp_enqueue_script('amw-galleria', $galleria_js, 'jquery', $this->galleriaVersion); wp_enqueue_script('amw-galleria-theme', $theme_js, 'amw-galleria', $this->version); wp_enqueue_style( 'amw-galleria-style', $theme_css, array(), $this->version); } add_action( 'wp_enqueue_scripts', 'add_scripts_to' );
I really need an help.
- The topic ‘"Notice: wp_enqueue_script was called incorrectly" on an old plugin.’ is closed to new replies.