Make WordPress Core

Changeset 21617


Ignore:
Timestamp:
08/25/2012 04:53:32 PM (12 years ago)
Author:
lancewillett
Message:

Twenty Twelve: review and clarify code commenting and documentation. Props jorbin and obenland. See #21675.

Location:
trunk/wp-content/themes/twentytwelve
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/themes/twentytwelve/editor-style-rtl.css

    r21515 r21617  
    11/*
    22Theme Name: Twenty Twelve
    3 
    4 Used to style the TinyMCE editor for RTL languages.
    5 See also rtl.css
     3Description: Used to style the TinyMCE editor for RTL languages.
     4See also rtl.css file.
    65*/
    76
  • trunk/wp-content/themes/twentytwelve/editor-style.css

    r21409 r21617  
    1 /**
    2 * Theme Name: Twenty Twelve
    3 * Description: Used to style the TinyMCE editor.
     1/*
     2Theme Name: Twenty Twelve
     3Description: Used to style the TinyMCE editor.
    44*/
    55
  • trunk/wp-content/themes/twentytwelve/functions.php

    r21611 r21617  
    11<?php
    22/**
    3  * Twenty Twelve functions and definitions
    4  *
    5  * Sets up the theme and provides some helper functions. Some helper functions
    6  * are used in the theme as custom template tags. Others are attached to action and
     3 * Twenty Twelve functions and definitions.
     4 *
     5 * Sets up the theme and provides some helper functions, which are used
     6 * in the theme as custom template tags. Others are attached to action and
    77 * filter hooks in WordPress to change core functionality.
    8  *
    9  * The first function, twentytwelve_setup(), sets up the theme by registering support
    10  * for various features in WordPress, such as a custom background and a navigation menu.
    118 *
    129 * When using a child theme (see http://codex.wordpress.org/Theme_Development and
     
    2724
    2825/**
    29  * Set the content width based on the theme's design and stylesheet.
     26 * Sets up the content width value based on the theme's design and stylesheet.
    3027 */
    3128if ( ! isset( $content_width ) )
     
    3330
    3431/**
    35  * Sets up theme defaults and registers support for various WordPress features.
     32 * Sets up theme defaults and registers the various WordPress features that
     33 * Twenty Twelve supports.
    3634 *
    3735 * @uses load_theme_textdomain() For translation/localization support.
    38  * @uses add_theme_support() To add support for post thumbnails, automatic feed links, custom headers
    39  *  and backgrounds, and post formats.
     36 * @uses add_editor_style() To add a Visual Editor stylesheet.
     37 * @uses add_theme_support() To add support for post thumbnails, automatic feed links,
     38 *  custom background, and post formats.
    4039 * @uses register_nav_menu() To add support for navigation menus.
    4140 * @uses set_post_thumbnail_size() To set a custom post thumbnail size.
     
    4645    global $twentytwelve_options;
    4746
    48     /**
    49      * Make Twenty Twelve available for translation.
     47    /*
     48     * Makes Twenty Twelve available for translation.
     49     *
    5050     * Translations can be added to the /languages/ directory.
    5151     * If you're building a theme based on Twenty Twelve, use a find and replace
     
    6161    add_editor_style();
    6262
    63     // Add default posts and comments RSS feed links to <head>.
     63    // Adds RSS feed links to <head> for posts and comments.
    6464    add_theme_support( 'automatic-feed-links' );
    6565
    66     // Add support for a variety of post formats
     66    // This theme supports a variety of post formats.
    6767    add_theme_support( 'post-formats', array( 'aside', 'image', 'link', 'quote' ) );
    6868
     
    7070    register_nav_menu( 'primary', __( 'Primary Menu', 'twentytwelve' ) );
    7171
    72     // Add support for custom background.
     72    /*
     73     * This theme supports custom background color and image, and here
     74     * we also set up the default background color.
     75     */
    7376    add_theme_support( 'custom-background', array(
    7477        'default-color' => 'e6e6e6',
    7578    ) );
    7679
    77     // Add custom image size for featured image use, displayed on "standard" posts.
     80    // This theme uses a custom image size for featured images, displayed on "standard" posts.
    7881    add_theme_support( 'post-thumbnails' );
    7982    set_post_thumbnail_size( 624, 9999 ); // Unlimited height, soft crop
     
    8285
    8386/**
    84  * Add support for a custom header image.
     87 * Adds support for a custom header image.
    8588 */
    8689require( get_template_directory() . '/inc/custom-header.php' );
    8790
    8891/**
    89  * Enqueue scripts and styles for front-end.
     92 * Enqueues scripts and styles for front-end.
    9093 *
    9194 * @since Twenty Twelve 1.0
     
    9497    global $twentytwelve_options;
    9598
    96     /**
    97      * Add JavaScript to pages with the comment form to support
     99    /*
     100     * Adds JavaScript to pages with the comment form to support
    98101     * sites with threaded comments (when in use).
    99102     */
     
    101104        wp_enqueue_script( 'comment-reply' );
    102105
    103     /**
    104      * JavaScript for handling navigation menus and the resized
    105      * styles for small screen sizes.
     106    /*
     107     * Adds JavaScript for handling the navigation menu hide-and-show behavior.
    106108     */
    107109    wp_enqueue_script( 'twentytwelve-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20120824', true );
    108110
    109     /**
    110      * Load special font CSS file.
     111    /*
     112     * Loads our special font CSS file.
    111113     * Depends on Theme Options setting.
    112114     */
     
    115117        wp_enqueue_style( 'twentytwelve-fonts', $twentytwelve_options->custom_fonts_url(), array(), null );
    116118
    117     /**
    118      * Load our main CSS file.
     119    /*
     120     * Loads our main stylesheet.
    119121     */
    120122    wp_enqueue_style( 'twentytwelve-style', get_stylesheet_uri() );
    121123
    122     /**
    123      * Load HTML5 shiv for older IE version support for HTML5 elements.
     124    /*
     125     * Loads HTML5 JavaScript file to add support for HTML5 elements in older IE versions.
    124126     * Ideally, should load after main CSS file.
    125      *
    126127     * See html5.js link in header.php.
    127128     *
     
    165166
    166167/**
    167  * Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link.
     168 * Makes our wp_nav_menu() fallback -- wp_page_menu() -- show a home link.
    168169 *
    169170 * @since Twenty Twelve 1.0
     
    176177
    177178/**
    178  * Register our single widget area.
     179 * Registers our main widget area and the homepage widget areas.
    179180 *
    180181 * @since Twenty Twelve 1.0
     
    214215
    215216/**
    216  * Count the number of footer sidebars to enable dynamic classes for the footer
     217 * Counts the number of footer sidebars to enable dynamic classes for the footer.
    217218 *
    218219 * @since Twenty Twelve 1.0
     
    229230if ( ! function_exists( 'twentytwelve_content_nav' ) ) :
    230231/**
    231  * Display navigation to next/previous pages when applicable.
     232 * Displays navigation to next/previous pages when applicable.
    232233 *
    233234 * @since Twenty Twelve 1.0
     
    365366 *
    366367 * @since Twenty Twelve 1.0
     368 *
     369 * @param array Existing class values.
     370 * @return array Filtered class values.
    367371 */
    368372function twentytwelve_body_class( $classes ) {
     
    385389
    386390/**
    387  * Adjust $content width for full-width and single image attachment templates
    388  * and when there are no active widgets in the sidebar.
     391 * Adjusts content_width value for full-width and single image attachment
     392 * templates, and when there are no active widgets in the sidebar.
    389393 *
    390394 * @since Twenty Twelve 1.0
  • trunk/wp-content/themes/twentytwelve/inc/custom-header.php

    r21329 r21617  
    11<?php
    22/**
    3  * Implement an optional custom header for Twenty Twelve.
    4  * http://codex.wordpress.org/Custom_Headers
     3 * Implements an optional custom header for Twenty Twelve.
     4 * See http://codex.wordpress.org/Custom_Headers
    55 *
    66 * @package WordPress
     
    1010
    1111/**
    12  * Set up the WordPress core custom header arguments and settings.
    13  * Use add_theme_support() to register support for 3.4 and up.
     12 * Sets up the WordPress core custom header arguments and settings.
    1413 *
    15  * @uses twentytwelve_header_style()
    16  * @uses twentytwelve_admin_header_style()
    17  * @uses twentytwelve_admin_header_image()
     14 * @uses add_theme_support() to register support for 3.4 and up.
     15 * @uses twentytwelve_header_style() to style front-end.
     16 * @uses twentytwelve_admin_header_style() to style wp-admin form.
     17 * @uses twentytwelve_admin_header_image() to add custom markup to wp-admin form.
    1818 *
    1919 * @since Twenty Twelve 1.0
     
    127127
    128128/**
    129  * Custom header image markup displayed on the Appearance > Header admin panel.
     129 * Outputs markup to be displayed on the Appearance > Header admin panel.
     130 * This callback overrides the default markup displayed there.
    130131 *
    131132 * @since Twenty Twelve 1.0
  • trunk/wp-content/themes/twentytwelve/inc/theme-options.php

    r21448 r21617  
    2727
    2828    /**
    29      * Constructor
     29     * Constructor.
    3030     *
    3131     * @access public
     
    4545
    4646    /**
    47      * Register the form setting for our options array.
     47     * Registers the form setting for our options array.
    4848     *
    4949     * This function is attached to the admin_init action hook.
     
    8787
    8888    /**
    89      * Add our theme options page to the admin menu.
     89     * Adds our theme options page to the admin menu.
    9090     *
    9191     * This function is attached to the admin_menu action hook.
     
    149149
    150150    /**
    151      * Returns the options array.
     151     * Displays the theme options page.
    152152     *
    153153     * @uses get_current_theme() for back compat, fallback for < 3.4
     
    176176
    177177    /**
    178      * Sanitize and validate form input. Accepts an array, return a sanitized array.
     178     * Sanitizes and validates form input.
    179179     *
    180180     * @see options_init()
     
    196196
    197197    /**
    198      * Implement Twenty Twelve theme options into Theme Customizer.
     198     * Implements Twenty Twelve theme options into Theme Customizer.
    199199     *
    200200     * @since Twenty Twelve 1.0
     
    234234
    235235    /**
    236      * Bind JS handlers to make Theme Customizer preview reload changes asynchronously.
     236     * Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
    237237     *
    238238     * @since Twenty Twelve 1.0
     
    250250
    251251    /**
    252      * Create path to load fonts CSS file with correct protocol.
     252     * Creates path to load fonts CSS file with correct protocol.
    253253     *
    254254     * @since Twenty Twelve 1.0
  • trunk/wp-content/themes/twentytwelve/rtl.css

    r21611 r21617  
    11/*
    22Theme Name: Twenty Twelve
    3 
    4 Adding support for language written in a Right To Left (RTL) direction is easy -
    5 it's just a matter of overwriting all the horizontal positioning attributes
     3Description: Adds support for languages written in a Right To Left (RTL) direction.
     4It's easy, just a matter of overwriting all the horizontal positioning attributes
    65of your CSS stylesheet in a separate stylesheet file named rtl.css.
    76
    8 http://codex.wordpress.org/Right_to_Left_Language_Support
     7See http://codex.wordpress.org/Right_to_Left_Language_Support
    98*/
    109
  • trunk/wp-content/themes/twentytwelve/sidebar-home.php

    r21555 r21617  
    11<?php
    22/**
    3  * The Sidebar containing the homepage widget areas.
     3 * The sidebar containing the homepage widget areas.
    44 *
    55 * If no active widgets in either sidebar, they will be hidden completely.
     
    1111
    1212/*
    13 The homepage widget area is triggered if any of the areas
    14 have widgets. So let's check that first.
    15 
    16 If none of the sidebars have widgets, then let's bail early.
    17 */
     13 * The homepage widget area is triggered if any of the areas
     14 * have widgets. So let's check that first.
     15 *
     16 * If none of the sidebars have widgets, then let's bail early.
     17 */
    1818if ( ! is_active_sidebar( 2 ) && ! is_active_sidebar( 3 ) )
    1919    return;
  • trunk/wp-content/themes/twentytwelve/sidebar.php

    r21261 r21617  
    11<?php
    22/**
    3  * The Sidebar containing the main widget area.
     3 * The sidebar containing the main widget area.
    44 *
    5  * If no active widgets in sidebar, hide it completely.
     5 * If no active widgets in sidebar, let's hide it completely.
    66 *
    77 * @package WordPress
Note: See TracChangeset for help on using the changeset viewer.