Make WordPress Core


Ignore:
Timestamp:
03/15/2013 06:24:45 PM (12 years 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.

File:
1 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/**
Note: See TracChangeset for help on using the changeset viewer.