#21975 closed enhancement (invalid)
Twenty Twelve: Register navigation.js before enqueue script?
Reported by: | MattV | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.4.2 |
Component: | Bundled Theme | Keywords: | 2nd-opinion |
Focuses: | Cc: |
Description
The navigation script in Twenty Twelve theme is not registered before it´s enqueued. If a user wants to replace or remove this script in a child theme, he/she can´t deregister it.
Would it be better to replace line 107 in functions.php:
wp_enqueue_script( 'twentytwelve-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20120824', true );
With this?
wp_register_script( 'twentytwelve-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20120824', true ); wp_enqueue_script( 'twentytwelve-navigation' );
Thanks!
Change History (3)
Note: See
TracTickets for help on using
tickets.
As wp_enqueue_script() does registration, calling both one after the other is redundant.
There is both wp_deregister_script() and wp_dequeue_script(), so you can easily remove the handle from the queue or all together. Even if it was registered with "enqueue", dequeueing it keeps it registered.