Skip to content

Commit

Permalink
Call wp_enqueue_script from within an action.
Browse files Browse the repository at this point in the history
As of WP 3.3 this is the preferred usage.

Thanks to Henry C. Gernhardt, III and Martin Lormes for reporting
this issue.
  • Loading branch information
beastaugh committed Jan 22, 2012
1 parent faae642 commit d563354
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 7 deletions.
8 changes: 8 additions & 0 deletions changelog.txt
@@ -1,5 +1,13 @@
# Changelog

### Version 3.1.3

#### Bug fixes

* `wp_enqueue_script` is now only called from within actions, as per a change
in WordPress 3.3.


### Version 3.1.2

#### Bug fixes
Expand Down
5 changes: 1 addition & 4 deletions functions.php
Expand Up @@ -174,10 +174,7 @@
add_action('admin_head', 'maybe_wipe_tarski_options');
} else {
// JavaScript
wp_enqueue_script('tarski',
tarski_asset_path('app/js/tarski.js'),
array('jquery'), theme_version());
wp_enqueue_script('comment-reply');
add_action('wp_enqueue_scripts', 'tarski_enqueue_scripts');
}

// Header
Expand Down
23 changes: 22 additions & 1 deletion library/helpers/template_helper.php
Expand Up @@ -156,6 +156,28 @@ function tarski_meta() {
_tarski_asset_output('asset_meta', $meta);
}

/**
* Enqueue Tarski's own JavaScript and the comment reply script.
*
* @since 3.1.3
*
* @uses wp_enqueue_script
* @uses tarski_asset_path
* @uses theme_version
*
* @see tarski_meta
* @see tarski_stylesheets
*
* @return void
*/
function tarski_enqueue_scripts() {
wp_enqueue_script('tarski',
tarski_asset_path('app/js/tarski.js'),
array('jquery'), theme_version());

wp_enqueue_script('comment-reply');
}

/**
* Generate links to the various Tarski stylesheets.
*
Expand All @@ -167,7 +189,6 @@ function tarski_meta() {
* @uses _tarski_asset_output
*
* @see tarski_meta
* @see tarski_javascript
*
* @return void
*
Expand Down
2 changes: 1 addition & 1 deletion style.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion style.dev.css
Expand Up @@ -5,7 +5,7 @@ Description: An elegant, flexible theme developed by <a href="http://extralogica
Author: Benedict Eastaugh and Chris Sternal-Johnson
Author URI: http://tarskitheme.com/about/
Tags: white, two-columns, left-sidebar, right-sidebar, fixed-width, custom-colors, custom-header, custom-background, custom-menu, editor-style, theme-options, threaded-comments, sticky-post, microformats, rtl-language-support, translation-ready
Version: 3.1.2
Version: 3.1.3
License: GNU General Public License, v2
License URI: http://www.opensource.org/licenses/gpl-2.0.html
*/
Expand Down

0 comments on commit d563354

Please sign in to comment.