Make WordPress Core


Ignore:
Timestamp:
09/02/2013 11:02:15 PM (11 years ago)
Author:
lancewillett
Message:

Twenty Fourteen: first pass at adding editor stylesheet. Props Frank Klein, see #25084.

File:
1 edited

Legend:

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

    r25090 r25217  
    5050     */
    5151    load_theme_textdomain( 'twentyfourteen', get_template_directory() . '/languages' );
     52
     53    /*
     54    * This theme styles the visual editor to resemble the theme style.
     55    */
     56    add_editor_style( array( 'editor-style.css', twentyfourteen_font_url() ) );
    5257
    5358    // Adds RSS feed links to <head> for posts and comments.
     
    175180
    176181/**
    177  * Register Google fonts for Twenty Fourteen.
    178  *
    179  * @return void
    180  */
    181 function twentyfourteen_fonts() {
    182     /* translators: If there are characters in your language that are not supported
    183        by Lato, translate this to 'off'. Do not translate into your own language. */
     182 * Register Lato Google font for Twenty Fourteen.
     183 *
     184 * @return void
     185 */
     186function twentyfourteen_font_url() {
     187    $font_url = '';
     188    /*
     189     * Translators: If there are characters in your language that are not supported
     190     * by Lato, translate this to 'off'. Do not translate into your own language.
     191     */
    184192    if ( 'off' !== _x( 'on', 'Lato font: on or off', 'twentyfourteen' ) )
    185         wp_register_style( 'twentyfourteen-lato', '//fonts.googleapis.com/css?family=Lato:100,300,400,700,900,100italic,300italic,400italic,700italic,900italic', array(), null );
    186 }
    187 add_action( 'init', 'twentyfourteen_fonts' );
     193        $font_url = add_query_arg( 'family', urlencode( 'Lato:100,300,400,700,900,100italic,300italic,400italic,700italic,900italic' ), "//fonts.googleapis.com/css" );
     194
     195    return $font_url;
     196}
    188197
    189198/**
     
    213222
    214223    wp_enqueue_script( 'twentyfourteen-theme', get_template_directory_uri() . '/js/theme.js', array( 'jquery' ), '20130820', true );
     224
     225    // Add Lato font used in the main stylesheet.
     226    wp_enqueue_style( 'twentyfourteen-lato', twentyfourteen_font_url(), array(), null );
    215227}
    216228add_action( 'wp_enqueue_scripts', 'twentyfourteen_scripts' );
Note: See TracChangeset for help on using the changeset viewer.