Make WordPress Core


Ignore:
Timestamp:
10/11/2013 10:01:14 PM (12 years ago)
Author:
lancewillett
Message:

Twenty Fourteen: first pass for updating code comments to reflect WP inline docs standards, see #25257.

File:
1 edited

Legend:

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

    r25762 r25769  
    11<?php
    22/**
    3  * Twenty Fourteen functions and definitions.
    4  *
    5  * Sets up the theme and provides some helper functions, which are used in the
     3 * Twenty Fourteen functions and definitions
     4 *
     5 * Set up the theme and provides some helper functions, which are used in the
    66 * theme as custom template tags. Others are attached to action and filter
    77 * hooks in WordPress to change core functionality.
     
    1818 *
    1919 * For more information on hooks, actions, and filters,
    20  * see http://codex.wordpress.org/Plugin_API
     20 * @link http://codex.wordpress.org/Plugin_API
    2121 *
    2222 * @package WordPress
    2323 * @subpackage Twenty_Fourteen
    24  */
    25 
    26 /**
    27  * Sets up the content width value based on the theme's design.
    28  * @see twentyfourteen_content_width() for template-specific adjustments.
     24 * @since Twenty Fourteen 1.0
     25 */
     26
     27/**
     28 * Set up the content width value based on the theme's design.
     29 *
     30 * @link twentyfourteen_content_width()
     31 *
     32 * @since Twenty Fourteen 1.0
    2933 */
    3034if ( ! isset( $content_width ) )
     
    3337if ( ! function_exists( 'twentyfourteen_setup' ) ) :
    3438/**
    35  * Sets up theme defaults and registers support for various WordPress features.
     39 * Twenty Fourteen setup.
     40 *
     41 * Set up theme defaults and registers support for various WordPress features.
    3642 *
    3743 * Note that this function is hooked into the after_setup_theme hook, which
    3844 * runs before the init hook. The init hook is too late for some features, such
    3945 * as indicating support post thumbnails.
     46 *
     47 * @since Twenty Fourteen 1.0
    4048 */
    4149function twentyfourteen_setup() {
    4250
    4351    /*
    44      * Makes Twenty Fourteen available for translation.
     52     * Make Twenty Fourteen available for translation.
    4553     *
    4654     * Translations can be added to the /languages/ directory.
     
    5159    load_theme_textdomain( 'twentyfourteen', get_template_directory() . '/languages' );
    5260
    53     /*
    54     * This theme styles the visual editor to resemble the theme style.
    55     */
     61    // This theme styles the visual editor to resemble the theme style.
    5662    add_editor_style( array( 'editor-style.css', twentyfourteen_font_url() ) );
    5763
    58     // Adds RSS feed links to <head> for posts and comments.
     64    // Add RSS feed links to <head> for posts and comments.
    5965    add_theme_support( 'automatic-feed-links' );
    6066
     
    6268    add_theme_support( 'post-thumbnails' );
    6369
    64     // Adding several sizes for Post Thumbnails.
     70    // Add several sizes for Post Thumbnails.
    6571    add_image_size( 'featured-thumbnail-large', 672, 0 );
    6672    add_image_size( 'featured-thumbnail-featured', 672, 336, true );
     
    7480
    7581    /*
    76      * Switches default core markup for search form, comment form, and comments
     82     * Switch default core markup for search form, comment form, and comments
    7783     * to output valid HTML5.
    7884     */
     
    100106
    101107/**
    102  * Adjusts content_width value for full-width and attachment templates.
     108 * Adjust content_width value for full-width and attachment templates.
     109 *
     110 * @since Twenty Fourteen 1.0
    103111 *
    104112 * @return void
     
    112120/**
    113121 * Getter function for Featured Content Plugin.
     122 *
     123 * @since Twenty Fourteen 1.0
    114124 */
    115125function twentyfourteen_get_featured_posts() {
     
    121131 * So that we can use a condition like
    122132 * if ( twentyfourteen_has_featured_posts( 1 ) )
     133 *
     134 * @since Twenty Fourteen 1.0
    123135 */
    124136function twentyfourteen_has_featured_posts( $minimum = 1 ) {
     
    132144
    133145/**
    134  * Registers two widget areas.
     146 * Register two widget areas.
     147 *
     148 * @since Twenty Fourteen 1.0
    135149 *
    136150 * @return void
     
    173187 * Register Lato Google font for Twenty Fourteen.
    174188 *
     189 * @since Twenty Fourteen 1.0
     190 *
    175191 * @return void
    176192 */
     
    188204
    189205/**
    190  * Enqueues scripts and styles for front end.
     206 * Enqueue scripts and styles for front end.
     207 *
     208 * @since Twenty Fourteen 1.0
    191209 *
    192210 * @return void
     
    222240 * Enqueue Google fonts style to admin screen for custom header display.
    223241 *
     242 * @since Twenty Fourteen 1.0
     243 *
    224244 * @return void
    225245 */
     
    230250
    231251/**
    232  * Sets the post excerpt length to 20 words.
     252 * Set the post excerpt length to 20 words.
     253 *
     254 * @since Twenty Fourteen 1.0
    233255 *
    234256 * @param int $length
     
    241263
    242264/**
    243  * Returns a "Continue Reading" link for excerpts
     265 * Return a "Continue Reading" link for excerpts.
     266 *
     267 * @since Twenty Fourteen 1.0
    244268 *
    245269 * @return string
     
    250274
    251275/**
    252  * Replaces "[...]" (appended to automatically generated excerpts) with an
     276 * Replace "[...]" (appended to automatically generated excerpts) with an
    253277 * ellipsis and twentyeleven_continue_reading_link().
     278 *
     279 * @since Twenty Fourteen 1.0
    254280 *
    255281 * @param string $more
     
    262288
    263289/**
    264  * Adds a pretty "Continue Reading" link to custom post excerpts.
     290 * Add a pretty "Continue Reading" link to custom post excerpts.
    265291 *
    266292 * To override this link in a child theme, remove the filter and add your own
    267293 * function tied to the get_the_excerpt filter hook.
     294 *
     295 * @since Twenty Fourteen 1.0
    268296 *
    269297 * @param string $output
     
    280308if ( ! function_exists( 'twentyfourteen_the_attached_image' ) ) :
    281309/**
    282  * Prints the attached image with a link to the next attached image.
     310 * Print the attached image with a link to the next attached image.
     311 *
     312 * @since Twenty Fourteen 1.0
    283313 *
    284314 * @return void
     
    289319    $next_attachment_url = wp_get_attachment_url();
    290320
    291     /**
     321    /*
    292322     * Grab the IDs of all the image attachments in a gallery so we can get the URL
    293323     * of the next adjacent image in a gallery, or the first image (if we're
     
    333363if ( ! function_exists( 'twentyfourteen_list_authors' ) ) :
    334364/**
    335  * Prints a list of all site contributors who published at least one post.
     365 * Print a list of all site contributors who published at least one post.
     366 *
     367 * @since Twenty Fourteen 1.0
    336368 *
    337369 * @return void
     
    373405
    374406/**
    375  * Gets recent formatted posts that are not featured in FC plugin.
    376  *
     407 * Get recent formatted posts that are not featured in FC plugin.
     408 *
     409 * @since Twenty Fourteen 1.0
     410 *
     411 * @return object WP_Query
    377412 */
    378413function twentyfourteen_get_recent( $post_format ) {
     
    403438 * Filter the home page posts, and remove formatted posts visible in the sidebar from it
    404439 *
     440 * @since Twenty Fourteen 1.0
     441 *
     442 * @return void
    405443 */
    406444function twentyfourteen_pre_get_posts( $query ) {
     
    444482
    445483/**
    446  *  Extends the default WordPress body classes.
     484 * Extend the default WordPress body classes.
    447485 *
    448486 * Adds body classes to denote:
     
    452490 * 4. Presence of footer widgets.
    453491 *
     492 * @since Twenty Fourteen 1.0
     493 *
    454494 * @param array $classes A list of existing body class values.
    455495 * @return array The filtered body class list.
     
    476516
    477517/**
    478  * Extends the default WordPress post classes.
     518 * Extend the default WordPress post classes.
    479519 *
    480520 * Adds a post class to denote:
    481521 * Non-password protected page with a featured image.
     522 *
     523 * @since Twenty Fourteen 1.0
    482524 *
    483525 * @param array $classes A list of existing post class values.
     
    493535
    494536/**
    495  * Creates a nicely formatted and more specific title element text for output
     537 * Create a nicely formatted and more specific title element text for output
    496538 * in head of document, based on current view.
     539 *
     540 * @since Twenty Fourteen 1.0
    497541 *
    498542 * @param string $title Default title text for current view.
     
    522566add_filter( 'wp_title', 'twentyfourteen_wp_title', 10, 2 );
    523567
    524 /**
    525  * Implement the Custom Header feature
    526  *
    527  */
     568// Implement Custom Header features.
    528569require get_template_directory() . '/inc/custom-header.php';
    529570
    530 /**
    531  * Custom template tags for this theme.
    532  */
     571// Custom template tags for this theme.
    533572require get_template_directory() . '/inc/template-tags.php';
    534573
    535 /**
    536  * Customizer additions
    537  */
     574// Add Theme Customizer functionality.
    538575require get_template_directory() . '/inc/customizer.php';
Note: See TracChangeset for help on using the changeset viewer.