WordPress.org

Make WordPress Core

Changeset 27404


Ignore:
Timestamp:
03/05/2014 04:53:33 AM (6 years ago)
Author:
helen
Message:

Add a class attribute to the caption shortcode to allow for additional classes on the caption container. props rhyswynne, mcadwell. fixes #25295.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/media.php

    r27397 r27404  
    674674 *     @type int    $width   The width of the caption, in pixels.
    675675 *     @type string $caption The caption text.
     676 *     @type string $class   Additional class name(s) added to the caption container.
    676677 * }
    677678 * @param string $content Optional. Shortcode content.
     
    709710        'align'   => 'alignnone',
    710711        'width'   => '',
    711         'caption' => ''
     712        'caption' => '',
     713        'class'   => '',
    712714    ), $attr, 'caption' );
    713715
     
    742744        $style = 'style="width: ' . (int) $caption_width . 'px" ';
    743745
    744     return '<div ' . $atts['id'] . $style . 'class="wp-caption ' . esc_attr( $atts['align'] ) . '">'
     746    $class = trim( 'wp-caption ' . $atts['align'] . ' ' . $atts['class'] );
     747
     748    return '<div ' . $atts['id'] . $style . 'class="' . esc_attr( $class ) . '">'
    745749    . do_shortcode( $content ) . '<p class="wp-caption-text">' . $atts['caption'] . '</p></div>';
    746750}
Note: See TracChangeset for help on using the changeset viewer.