Make WordPress Core

Changeset 28927


Ignore:
Timestamp:
06/30/2014 03:54:04 PM (11 years ago)
Author:
helen
Message:

Support descriptions for individual customizer controls.

  • Control title (label) markup will also only be output if specified.
  • Control section descriptions are no longer italicized for visual hierarchy / differentiation.

props celloexpressions. fixes #27981.

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/css/customize-controls.css

    r28861 r28927  
    276276}
    277277
     278p.customize-section-description {
     279    font-style: normal;
     280}
     281
    278282.customize-control {
    279283    width: 100%;
     
    315319}
    316320
     321.customize-control-description {
     322    display: block;
     323    font-style: italic;
     324    line-height: 18px;
     325    margin-bottom: 5px;
     326}
     327
    317328.customize-control-color .color-picker,
    318329.customize-control-checkbox label,
     
    332343    margin-bottom: 0;
    333344    line-height: 22px;
     345}
     346
     347.customize-control-radio .customize-control-title + .customize-control-description {
     348    margin-top: 7px;
    334349}
    335350
  • trunk/src/wp-includes/class-wp-customize-control.php

    r28509 r28927  
    5353     */
    5454    public $label = '';
     55
     56    /**
     57     * @access public
     58     * @var string
     59     */
     60    public $description = '';
    5561
    5662    /**
     
    259265                ?>
    260266                <label>
    261                     <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
     267                    <?php if ( ! empty( $this->label ) ) : ?>
     268                        <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
     269                    <?php endif;
     270                    if ( ! empty( $this->description ) ) : ?>
     271                        <span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span>
     272                    <?php endif; ?>
    262273                    <input type="text" value="<?php echo esc_attr( $this->value() ); ?>" <?php $this->link(); ?> />
    263274                </label>
     
    269280                    <input type="checkbox" value="<?php echo esc_attr( $this->value() ); ?>" <?php $this->link(); checked( $this->value() ); ?> />
    270281                    <?php echo esc_html( $this->label ); ?>
     282                    <?php if ( ! empty( $this->description ) ) : ?>
     283                        <span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span>
     284                    <?php endif; ?>
    271285                </label>
    272286                <?php
     
    278292                $name = '_customize-radio-' . $this->id;
    279293
    280                 ?>
    281                 <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
    282                 <?php
     294                if ( ! empty( $this->label ) ) : ?>
     295                    <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
     296                <?php endif;
     297                if ( ! empty( $this->description ) ) : ?>
     298                    <span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span>
     299                <?php endif;
     300
    283301                foreach ( $this->choices as $value => $label ) :
    284302                    ?>
     
    296314                ?>
    297315                <label>
    298                     <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
     316                    <?php if ( ! empty( $this->label ) ) : ?>
     317                        <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
     318                    <?php endif;
     319                    if ( ! empty( $this->description ) ) : ?>
     320                        <span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span>
     321                    <?php endif; ?>
     322
    299323                    <select <?php $this->link(); ?>>
    300324                        <?php
     
    402426        ?>
    403427        <label>
    404             <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
     428            <?php if ( ! empty( $this->label ) ) : ?>
     429                <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
     430            <?php endif;
     431            if ( ! empty( $this->description ) ) : ?>
     432                <span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span>
     433            <?php endif; ?>
     434
    405435            <div class="customize-control-content">
    406436                <input class="color-picker-hex" type="text" maxlength="7" placeholder="<?php esc_attr_e( 'Hex Value' ); ?>"<?php echo $default_attr; ?> />
     
    459489        ?>
    460490        <label>
    461             <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
     491            <?php if ( ! empty( $this->label ) ) : ?>
     492                <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
     493            <?php endif;
     494            if ( ! empty( $this->description ) ) : ?>
     495                <span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span>
     496            <?php endif; ?>
    462497            <div>
    463498                <a href="#" class="button-secondary upload"><?php _e( 'Upload' ); ?></a>
     
    541576        ?>
    542577        <div class="customize-image-picker">
    543             <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
     578            <?php if ( ! empty( $this->label ) ) : ?>
     579                <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
     580            <?php endif;
     581            if ( ! empty( $this->description ) ) : ?>
     582                <span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span>
     583            <?php endif; ?>
    544584
    545585            <div class="customize-control-content">
  • trunk/src/wp-includes/class-wp-customize-section.php

    r28861 r28927  
    181181            <ul class="accordion-section-content">
    182182                <?php if ( ! empty( $this->description ) ) : ?>
    183                 <li><p class="description"><?php echo $this->description; ?></p></li>
     183                <li><p class="description customize-section-description"><?php echo $this->description; ?></p></li>
    184184                <?php endif; ?>
    185185                <?php
Note: See TracChangeset for help on using the changeset viewer.