WordPress.org

Make WordPress Core

Changeset 23720


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

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

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

Legend:

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

    r23718 r23720  
    328328 
    329329/** 
     330 * Enqueue scripts and styles. 
     331 * 
     332 * Hooked on priority 0 to make sure they are enqueued prior to dependent 
     333 * scripts/styles. This is only necessary because they were previously enqueued 
     334 * prior to wp_head() running, and we want to provide maximum 
     335 * backwards compatibility. 
     336 * 
     337 * @since Twenty Eleven 1.6 
     338 */ 
     339function twentyeleven_scripts() { 
     340    wp_enqueue_style( 'twentyeleven', get_stylesheet_uri() ); 
     341 
     342    /* We add some JavaScript to pages with the comment form 
     343     * to support sites with threaded comments (when in use). 
     344     */ 
     345    if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) 
     346        wp_enqueue_script( 'comment-reply' ); 
     347} 
     348add_action( 'wp_enqueue_scripts', 'twentyeleven_scripts', 0 ); 
     349 
     350/** 
    330351 * Sets the post excerpt length to 40 words. 
    331352 * 
  • trunk/wp-content/themes/twentyeleven/header.php

    r23718 r23720  
    2727<title><?php wp_title( '|', true, 'right' ); ?></title> 
    2828<link rel="profile" href="http://gmpg.org/xfn/11" /> 
    29 <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" /> 
    3029<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" /> 
    3130<!--[if lt IE 9]> 
     
    3332<![endif]--> 
    3433<?php 
    35     /* We add some JavaScript to pages with the comment form 
    36      * to support sites with threaded comments (when in use). 
    37      */ 
    38     if ( is_singular() && get_option( 'thread_comments' ) ) 
    39         wp_enqueue_script( 'comment-reply' ); 
    40  
    4134    /* Always have wp_head() just before the closing </head> 
    4235     * tag of your theme, or you will break many plugins, which 
Note: See TracChangeset for help on using the changeset viewer.