WordPress.org

Make WordPress Core

Changeset 23721


Ignore:
Timestamp:
03/15/13 18:24:45 (13 months ago)
Author:
lancewillett
Message:

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.

Location:
trunk/wp-content/themes/twentyten
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/themes/twentyten/functions.php

    r23719 r23721  
    215215} 
    216216endif; 
     217 
     218/** 
     219 * Enqueue scripts and styles. 
     220 * 
     221 * Hooked on priority 0 to make sure they are enqueued prior to dependent 
     222 * scripts/styles. This is only necessary because they were previously enqueued 
     223 * prior to wp_head() running, and we want to provide maximum 
     224 * backwards compatibility. 
     225 * 
     226 * @since Twenty Ten 1.6 
     227 */ 
     228function twentyten_scripts() { 
     229    wp_enqueue_style( 'twentyten', get_stylesheet_uri() ); 
     230 
     231    /* We add some JavaScript to pages with the comment form 
     232     * to support sites with threaded comments (when in use). 
     233     */ 
     234    if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) 
     235        wp_enqueue_script( 'comment-reply' ); 
     236} 
     237add_action( 'wp_enqueue_scripts', 'twentyten_scripts', 0 ); 
    217238 
    218239/** 
  • trunk/wp-content/themes/twentyten/header.php

    r23719 r23721  
    1515<title><?php wp_title( '|', true, 'right' ); ?></title> 
    1616<link rel="profile" href="http://gmpg.org/xfn/11" /> 
    17 <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" /> 
    1817<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" /> 
    1918<?php 
    20     /* We add some JavaScript to pages with the comment form 
    21      * to support sites with threaded comments (when in use). 
    22      */ 
    23     if ( is_singular() && get_option( 'thread_comments' ) ) 
    24         wp_enqueue_script( 'comment-reply' ); 
    25  
    2619    /* Always have wp_head() just before the closing </head> 
    2720     * tag of your theme, or you will break many plugins, which 
Note: See TracChangeset for help on using the changeset viewer.