WordPress.org

Make WordPress Core

Opened 19 months ago

Closed 19 months ago

Last modified 19 months ago

#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)

comment:1 nacin19 months ago

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.

comment:2 MattV19 months ago

  • Resolution set to invalid
  • Status changed from new to closed

Thanks, I just learnt a few things :)

comment:3 SergeyBiryukov19 months ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.