_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
This commit is contained in:
Ian Stewart 2012-02-14 16:10:45 +00:00
parent 0d87fcd173
commit f3dc4c227d
3 changed files with 11 additions and 2 deletions

View File

@ -100,8 +100,19 @@ add_action( 'widgets_init', '_s_widgets_init' );
* Enqueue scripts * Enqueue scripts
*/ */
function _s_scripts() { function _s_scripts() {
global $post;
wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'jquery' );
wp_enqueue_script( 'small-menu', get_template_directory_uri() . '/js/small-menu.js', 'jquery', '20120206', true ); 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' ); add_action( 'wp_enqueue_scripts', '_s_scripts' );

View File

@ -35,7 +35,6 @@
?></title> ?></title>
<link rel="profile" href="http://gmpg.org/xfn/11" /> <link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" /> <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' ); ?>" /> <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<!--[if lt IE 9]> <!--[if lt IE 9]>
<script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script> <script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script>

View File

@ -7,7 +7,6 @@
*/ */
get_header(); 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"> <div id="primary" class="site-content image-attachment">