Skip to content
This repository has been archived by the owner on Sep 16, 2019. It is now read-only.

Jquery never registered in enqueue-scripts.php and enqueued twice? #397

Closed
rebekahmonson opened this issue Jul 31, 2015 · 2 comments
Closed

Comments

@rebekahmonson
Copy link
Contributor

When adding some custom scripts in enqueue-scripts.php, I noticed the following:

  1. Wordpress version of jquery is deregistered.
// Deregister the jquery version bundled with WordPress.
    wp_deregister_script( 'jquery' );
  1. CDN version of jquery is enqueued (but not registered).
// CDN hosted jQuery placed in the header, as some plugins require that jQuery is loaded in the header.
    wp_enqueue_script( 'jquery', '//ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js', array(), '2.1.0', false );
  1. Then jquery is enqueued again.
wp_enqueue_script( 'jquery' );

Everything seems to be working, as-is, I just wasn't sure why jquery was enqueued twice and not registered. Could someone help me learn?

Sorry for the noob question, and thanks for the help. This is my first full-on theme build, and it's been great to learn using FoundationPress. Thanks for your hard work. 🙌

@kermage
Copy link

kermage commented Aug 1, 2015

A typo, should be

wp_register_script( 'jquery', '//ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js', array(), '2.1.0', false );

or could leave it as is and just delete the last enqueue line

wp_enqueue_script( 'jquery' );

@rebekahmonson
Copy link
Contributor Author

Thanks! Glad to know I'm not crazy. Fixed on my end, and will submit pr.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants