Tag Info

Hot answers tagged

4

Actually all styles should be placed in header. So WordPress doesn't have a parameter for doing this in the wp_enqueue_style function. ADDED: OK, if you really want to do it, there is a way. You can use print_late_styles() function which is called in footer. You just need to enqueue your styles when header is already passed. So you need to find some hook ...


1

You page is generating two errors: Uncaught TypeError: undefined is not a function. This is likely due to the fact that WordPress sets jQuery to NoConflict mode. Your script is using the $ shortcut and is failing. Modify your script accordingly, either replacing the shortcut or wrapping the jQuery. ...


1

It looks like you've overlooked the 5th input parameter of: wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer ); Namely the boolean $in_footer part, that will put the script in the footer, if set as true, else in the header. You can also use $deps to handle dependencies. Check out the Codex for more info. => I would stick to ...


1

Your snippet seems mostly ok, except that dependency is a list and should be array('jquery'). Also wp_enqueue_scripts should be use as more appropriate. You can check out Codex documentation for a complete example, see Example of Automatic Dependency Loading.


1

Use wp_register_script & wp_enqueue_script to enqueue the scripts the right way. add_action( 'wp_enqueue_scripts', 'enqueue_my_script' ); function enqueue_my_script() { wp_register_script( 'my-script', get_template_directory_uri() . '/cycle2.js', array( 'jquery' ) ); wp_register_script( 'enq-jquery', ...


1

Try to add the code to the footer using add_action('wp_footer', 'front_js', 99); where 99 specifies the order in which the functions are executed. Now it should be executed after your scripts are loaded.



Only top voted, non community-wiki answers of a minimum length are eligible