Twenty Ten: use callback in functions.php to enqueue scripts and styles rather than putting them directly in header.php template file. Props obenland, fixes #23772.

git-svn-id: http://core.svn.wordpress.org/trunk@23721 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Lance Willett 2013-03-15 18:24:45 +00:00
parent dd99d5ce94
commit f4b2484cc9
2 changed files with 21 additions and 7 deletions

View File

@ -215,6 +215,27 @@ function twentyten_admin_header_style() {
}
endif;
/**
* Enqueue scripts and styles.
*
* Hooked on priority 0 to make sure they are enqueued prior to dependent
* scripts/styles. This is only necessary because they were previously enqueued
* prior to wp_head() running, and we want to provide maximum
* backwards compatibility.
*
* @since Twenty Ten 1.6
*/
function twentyten_scripts() {
wp_enqueue_style( 'twentyten', get_stylesheet_uri() );
/* We add some JavaScript to pages with the comment form
* to support sites with threaded comments (when in use).
*/
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )
wp_enqueue_script( 'comment-reply' );
}
add_action( 'wp_enqueue_scripts', 'twentyten_scripts', 0 );
/**
* Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link.
*

View File

@ -14,15 +14,8 @@
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<title><?php wp_title( '|', true, 'right' ); ?></title>
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<?php
/* We add some JavaScript to pages with the comment form
* to support sites with threaded comments (when in use).
*/
if ( is_singular() && get_option( 'thread_comments' ) )
wp_enqueue_script( 'comment-reply' );
/* Always have wp_head() just before the closing </head>
* tag of your theme, or you will break many plugins, which
* generally use this hook to add elements to <head> such