Skip to content
Browse files

_s: move scripts into one function added to wp_enqueue_scripts

git-svn-id: https://wpcom-themes.svn.automattic.com/_s/@8936 d957f892-c61d-0410-b221-f235e6eecf30
  • Loading branch information...
1 parent 0d87fcd commit f3dc4c227dcdd8a43e0db93c322e3b61ed1477a4 @ianstewart ianstewart committed Feb 14, 2012
Showing with 11 additions and 2 deletions.
  1. +11 −0 functions.php
  2. +0 −1 header.php
  3. +0 −1 image.php
View
11 functions.php
@@ -100,8 +100,19 @@ function _s_widgets_init() {
* Enqueue scripts
*/
function _s_scripts() {
+ global $post;
+
wp_enqueue_script( 'jquery' );
+
wp_enqueue_script( 'small-menu', get_template_directory_uri() . '/js/small-menu.js', 'jquery', '20120206', true );
+
+ if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
+ wp_enqueue_script( 'comment-reply' );
+ }
+
+ if ( is_singular() && wp_attachment_is_image( $post->ID ) && ! is_admin() ) {
+ wp_enqueue_script( 'keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20120202' );
+ }
}
add_action( 'wp_enqueue_scripts', '_s_scripts' );
View
1 header.php
@@ -35,7 +35,6 @@
?></title>
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
-<?php if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) wp_enqueue_script( 'comment-reply' ); ?>
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<!--[if lt IE 9]>
<script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script>
View
1 image.php
@@ -7,7 +7,6 @@
*/
get_header();
-wp_enqueue_script( 'keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20120202' );
?>
<div id="primary" class="site-content image-attachment">

0 comments on commit f3dc4c2

Please sign in to comment.
Something went wrong with that request. Please try again.