WordPress.org

Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (4 years ago)
Author:
pento
Message:

Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.

File:
1 edited

Legend:

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

    r39226 r42343  
    1717function twentyfourteen_customize_register( $wp_customize ) {
    1818    // Add postMessage support for site title and description.
    19     $wp_customize->get_setting( 'blogname' )->transport          = 'postMessage';
    20     $wp_customize->get_setting( 'blogdescription' )->transport   = 'postMessage';
    21     $wp_customize->get_setting( 'header_textcolor' )->transport  = 'postMessage';
     19    $wp_customize->get_setting( 'blogname' )->transport         = 'postMessage';
     20    $wp_customize->get_setting( 'blogdescription' )->transport  = 'postMessage';
     21    $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
    2222
    2323    if ( isset( $wp_customize->selective_refresh ) ) {
    24         $wp_customize->selective_refresh->add_partial( 'blogname', array(
    25             'selector' => '.site-title a',
    26             'container_inclusive' => false,
    27             'render_callback' => 'twentyfourteen_customize_partial_blogname',
    28         ) );
    29         $wp_customize->selective_refresh->add_partial( 'blogdescription', array(
    30             'selector' => '.site-description',
    31             'container_inclusive' => false,
    32             'render_callback' => 'twentyfourteen_customize_partial_blogdescription',
    33         ) );
     24        $wp_customize->selective_refresh->add_partial(
     25            'blogname', array(
     26                'selector'            => '.site-title a',
     27                'container_inclusive' => false,
     28                'render_callback'     => 'twentyfourteen_customize_partial_blogname',
     29            )
     30        );
     31        $wp_customize->selective_refresh->add_partial(
     32            'blogdescription', array(
     33                'selector'            => '.site-description',
     34                'container_inclusive' => false,
     35                'render_callback'     => 'twentyfourteen_customize_partial_blogdescription',
     36            )
     37        );
    3438    }
    3539
     
    5054
    5155    // Add the featured content section in case it's not already there.
    52     $wp_customize->add_section( 'featured_content', array(
    53         'title'           => __( 'Featured Content', 'twentyfourteen' ),
    54         'description'     => sprintf( __( 'Use a <a href="%1$s">tag</a> to feature your posts. If no posts match the tag, <a href="%2$s">sticky posts</a> will be displayed instead.', 'twentyfourteen' ),
    55             esc_url( add_query_arg( 'tag', _x( 'featured', 'featured content default tag slug', 'twentyfourteen' ), admin_url( 'edit.php' ) ) ),
    56             admin_url( 'edit.php?show_sticky=1' )
    57         ),
    58         'priority'        => 130,
    59         'active_callback' => 'is_front_page',
    60     ) );
     56    $wp_customize->add_section(
     57        'featured_content', array(
     58            'title'           => __( 'Featured Content', 'twentyfourteen' ),
     59            'description'     => sprintf(
     60                __( 'Use a <a href="%1$s">tag</a> to feature your posts. If no posts match the tag, <a href="%2$s">sticky posts</a> will be displayed instead.', 'twentyfourteen' ),
     61                esc_url( add_query_arg( 'tag', _x( 'featured', 'featured content default tag slug', 'twentyfourteen' ), admin_url( 'edit.php' ) ) ),
     62                admin_url( 'edit.php?show_sticky=1' )
     63            ),
     64            'priority'        => 130,
     65            'active_callback' => 'is_front_page',
     66        )
     67    );
    6168
    6269    // Add the featured content layout setting and control.
    63     $wp_customize->add_setting( 'featured_content_layout', array(
    64         'default'           => 'grid',
    65         'sanitize_callback' => 'twentyfourteen_sanitize_layout',
    66     ) );
     70    $wp_customize->add_setting(
     71        'featured_content_layout', array(
     72            'default'           => 'grid',
     73            'sanitize_callback' => 'twentyfourteen_sanitize_layout',
     74        )
     75    );
    6776
    68     $wp_customize->add_control( 'featured_content_layout', array(
    69         'label'   => __( 'Layout', 'twentyfourteen' ),
    70         'section' => 'featured_content',
    71         'type'    => 'select',
    72         'choices' => array(
    73             'grid'   => __( 'Grid',   'twentyfourteen' ),
    74             'slider' => __( 'Slider', 'twentyfourteen' ),
    75         ),
    76     ) );
     77    $wp_customize->add_control(
     78        'featured_content_layout', array(
     79            'label'   => __( 'Layout', 'twentyfourteen' ),
     80            'section' => 'featured_content',
     81            'type'    => 'select',
     82            'choices' => array(
     83                'grid'   => __( 'Grid', 'twentyfourteen' ),
     84                'slider' => __( 'Slider', 'twentyfourteen' ),
     85            ),
     86        )
     87    );
    7788}
    7889add_action( 'customize_register', 'twentyfourteen_customize_register' );
     
    138149    }
    139150
    140     get_current_screen()->add_help_tab( array(
    141         'id'      => 'twentyfourteen',
    142         'title'   => __( 'Twenty Fourteen', 'twentyfourteen' ),
    143         'content' =>
    144             '<ul>' .
    145                 '<li>' . sprintf( __( 'The home page features your choice of up to 6 posts prominently displayed in a grid or slider, controlled by a <a href="%1$s">tag</a>; you can change the tag and layout in <a href="%2$s">Appearance &rarr; Customize</a>. If no posts match the tag, <a href="%3$s">sticky posts</a> will be displayed instead.', 'twentyfourteen' ), esc_url( add_query_arg( 'tag', _x( 'featured', 'featured content default tag slug', 'twentyfourteen' ), admin_url( 'edit.php' ) ) ), admin_url( 'customize.php' ), admin_url( 'edit.php?show_sticky=1' ) ) . '</li>' .
    146                 '<li>' . sprintf( __( 'Enhance your site design by using <a href="%s">Featured Images</a> for posts you&rsquo;d like to stand out (also known as post thumbnails). This allows you to associate an image with your post without inserting it. Twenty Fourteen uses featured images for posts and pages&mdash;above the title&mdash;and in the Featured Content area on the home page.', 'twentyfourteen' ), 'https://codex.wordpress.org/Post_Thumbnails#Setting_a_Post_Thumbnail' ) . '</li>' .
    147                 '<li>' . sprintf( __( 'For an in-depth tutorial, and more tips and tricks, visit the <a href="%s">Twenty Fourteen documentation</a>.', 'twentyfourteen' ), 'https://codex.wordpress.org/Twenty_Fourteen' ) . '</li>' .
    148             '</ul>',
    149     ) );
     151    get_current_screen()->add_help_tab(
     152        array(
     153            'id'      => 'twentyfourteen',
     154            'title'   => __( 'Twenty Fourteen', 'twentyfourteen' ),
     155            'content' =>
     156                '<ul>' .
     157                    '<li>' . sprintf( __( 'The home page features your choice of up to 6 posts prominently displayed in a grid or slider, controlled by a <a href="%1$s">tag</a>; you can change the tag and layout in <a href="%2$s">Appearance &rarr; Customize</a>. If no posts match the tag, <a href="%3$s">sticky posts</a> will be displayed instead.', 'twentyfourteen' ), esc_url( add_query_arg( 'tag', _x( 'featured', 'featured content default tag slug', 'twentyfourteen' ), admin_url( 'edit.php' ) ) ), admin_url( 'customize.php' ), admin_url( 'edit.php?show_sticky=1' ) ) . '</li>' .
     158                    '<li>' . sprintf( __( 'Enhance your site design by using <a href="%s">Featured Images</a> for posts you&rsquo;d like to stand out (also known as post thumbnails). This allows you to associate an image with your post without inserting it. Twenty Fourteen uses featured images for posts and pages&mdash;above the title&mdash;and in the Featured Content area on the home page.', 'twentyfourteen' ), 'https://codex.wordpress.org/Post_Thumbnails#Setting_a_Post_Thumbnail' ) . '</li>' .
     159                    '<li>' . sprintf( __( 'For an in-depth tutorial, and more tips and tricks, visit the <a href="%s">Twenty Fourteen documentation</a>.', 'twentyfourteen' ), 'https://codex.wordpress.org/Twenty_Fourteen' ) . '</li>' .
     160                '</ul>',
     161        )
     162    );
    150163}
    151164add_action( 'admin_head-themes.php', 'twentyfourteen_contextual_help' );
    152 add_action( 'admin_head-edit.php',   'twentyfourteen_contextual_help' );
     165add_action( 'admin_head-edit.php', 'twentyfourteen_contextual_help' );
Note: See TracChangeset for help on using the changeset viewer.