Enqueueing Scripts and Styles

I think you are using the wp_enqueue_style the wrong way as it is not an action hook. wp_enqueue_scripts action hook is being used for enqueuing both scripts and styles. try this: function my_scripts_method() { wp_deregister_script( ‘jquery’ ); wp_deregister_script( ‘style’ ); wp_register_script( ‘jquery’, ‘//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js’ ); wp_register_style(‘style’, ‘//siteripe.com/style.css’ ); wp_enqueue_style(‘style’); } add_action(‘wp_enqueue_scripts’, ‘my_scripts_method’);

Unexpected script loading order

Simple Fix The reason why your code does not work is because the third parameter of the wp_enqueue_script() function is expecting an array, not a string. Just replace ‘footer-js’ with array(‘footer-js’) and it will work: function tallulah_scripts() { wp_enqueue_script( ‘header-js’, get_template_directory_uri() . ‘/js/header.min.js’, null, ‘1.0’, false ); wp_deregister_script(‘jquery’); wp_enqueue_script( ‘footer-js’, get_template_directory_uri() . ‘/js/footer.min.js’, null, ‘1.0’, … Read more

Conditional Javascript based on WP Version

You can do this with the function get_bloginfo(). There is a special paramater called version that retrieves the wordpress version from the $wp_version variable set in wp-includes/version.php. So you could do something like this function register_jquery_wp_version() { global $wp_version; if ( $wp_version >= 3.8 ) { // register and enqueue jquery A }elseif( $wp_version >= … Read more

Scripts not loading through function Method in WordPress Theme

There are several fundamental problems with what you’re trying to do that prevent you reaching your goal The Problems Naming You register 2 scripts, but you name them both ‘custom’. How is WordPress supposed to know which script you meant when you later tell it to display ‘custom’? /* Register scripts. */ wp_register_script( ‘custom’, JS … Read more