How to change script order?

wp_enqueue_script has $deps parameter which exactly does what you need. wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer ) Let’s say that your custom code is in a file named custom.js which is enqueued with a handle my-custom and you want this to be loded before my-script1 which is en-queued with a handle. wp_enqueue_script( ‘my-custom’, ‘/path/to/customjs’, array() … Read more

WordPress loads Jquery Automatically – is my idea correct to add it to the footer?

You shouldn’t enqueue jQuery by manually using wp_enqueue_script(‘jquery’);. WordPress can enqueue it for you the right way. All you have to do is to declare jQuery as your script’s dependency: wp_enqueue_script( ‘my-script’, get_template_directory_uri() .’/my-script.js’, array(‘jquery’), null, true ); You can pass an array of dependencies as the 3rd parameter. Also, by setting the 5th parameter … Read more

404 Error on trying to enqueue a JS file

Your syntax is wrong. The action must be defined outside of the callback. Also, you are using plugin_dir_path() function, which gets the path to plugin directoy in the filesystem of the server, not the url. You should use plugin_dir_url() instead. add_action( ‘wp_enqueue_scripts’, ‘myplugin_load_script’ ); function myplugin_load_script() { wp_enqueue_script( ‘myplugin-testjs’, plugin_dir_url( __FILE__ ) . “scripts/myplugin-test.js”, array(‘jquery’), … Read more

How to place script in footer?

If you want to output a single line of javascript, you might not need to put it in a js file and go through enqueuing it and stuff. Simply output it by using the wp_footer() action hook: add_action(‘wp_footer’,’print_my_script’); function print_my_script(){ echo ‘<script> // Your script here </script>’; } However, this is good just for small … Read more

How to remove scripts/style added to customize_controls_enqueue_scripts hook by current active theme

You can use the global $wp_scripts and global $wp_styles; to get all registerd scripts and styles. Eg. All Scripts // All Scripts global $wp_scripts; $all_scripts = array(); foreach( $wp_scripts->registered as $script ) : $all_scripts[$script->handle] = $script->src; endforeach; // echo ‘<pre>’; // print_r( $all_scripts ); // echo ‘</pre>’; All Styles // All Styles global $wp_styles; $all_styles … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)