Solved: warnings about wp_enqueue
-
this plugin works out of the box but has two issues. it generates several warnings and it forces you to enter a width and height even if you’re not uploading images.
Solution to the warnings:
wrap the top css/js lines in a function, then reference the function in an add_action like this.
function my_scripts(){ $style = 'emwi-css'; $css_file = plugins_url( '/external-media-without-import.css', __FILE__ ); wp_register_style( $style, $css_file ); wp_enqueue_style( $style ); $script = 'emwi-js'; $js_file = plugins_url( '/external-media-without-import.js', __FILE__ ); wp_register_script( $script, $js_file, array( 'jquery' ) ); wp_enqueue_script( $script ); } add_action('wp_enqueue_scripts', 'my_scripts');
Solution to the image requirement:
comment out the //return $input; line around line 210.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Solved: warnings about wp_enqueue’ is closed to new replies.