Make WordPress Core

Changeset 23984


Ignore:
Timestamp:
04/14/2013 01:11:44 AM (12 years ago)
Author:
markjaquith
Message:

Only remove ONE piece of media from the content in setup_postdata().

props wonderboymusic. fixes #24052.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/css/wp-admin.css

    r23976 r23984  
    39843984}
    39853985
    3986 .wp-format-media-holder.empty {
     3986.wp-format-media-holder.empty,
     3987.wp-format-audio .wp-format-media-holder,
     3988.wp-format-video .wp-format-media-holder {
    39873989    height: auto;
    39883990    padding: 55px 0 20px;
     
    40134015}
    40144016
    4015 .empty .wp-format-media-select {
     4017.empty .wp-format-media-select,
     4018.wp-format-audio .wp-format-media-select,
     4019.wp-format-video .wp-format-media-select {
    40164020    height: 20px;
    40174021}
  • trunk/wp-includes/media.php

    r23969 r23984  
    18461846 * @param boolean $html Whether to return HTML or URLs
    18471847 * @param boolean $remove Whether to remove the found URL from the passed content.
     1848 * @param int $limit Optional. The number of medias to return
    18481849 * @return array A list of parsed shortcodes or extracted srcs
    18491850 */
    1850 function get_content_media( $type, &$content, $html = true, $remove = false ) {
     1851function get_content_media( $type, &$content, $html = true, $remove = false, $limit = 0 ) {
    18511852    $items = array();
    18521853    $matches = array();
     
    18601861
    18611862                $items[] = do_shortcode_tag( $shortcode );
     1863                if ( $limit > 0 && count( $items ) >= $limit )
     1864                    break;
    18621865            }
    18631866        }
     
    20442047 * @param string $type Required. 'audio' or 'video'
    20452048 * @param WP_Post $post Optional. Used instead of global $post when passed.
     2049 * @param int $limit Optional. The number of medias to remove if content is scanned.
    20462050 * @return string
    20472051 */
    2048 function get_the_post_format_media( $type, &$post = null ) {
     2052function get_the_post_format_media( $type, &$post = null, $limit = 0 ) {
    20492053    global $wp_embed;
    20502054
     
    20912095    $content = $post->post_content;
    20922096
    2093     $htmls = get_content_media( $type, $content, true, true );
     2097    $htmls = get_content_media( $type, $content, true, true, $limit );
    20942098    if ( ! empty( $htmls ) ) {
    20952099        $html = reset( $htmls );
     
    21342138 */
    21352139function the_post_format_video() {
    2136     echo get_the_post_format_media( 'video' );
     2140    $null = null;
     2141    echo get_the_post_format_media( 'video', $null, 1 );
    21372142}
    21382143/**
     
    21432148 */
    21442149function the_post_format_audio() {
    2145     echo get_the_post_format_media( 'audio' );
     2150    $null = null;
     2151    echo get_the_post_format_media( 'audio', $null, 1 );
    21462152}
    21472153
  • trunk/wp-includes/query.php

    r23899 r23984  
    37033703            break;
    37043704        case 'audio':
    3705             get_the_post_format_media( 'audio', $post );
     3705            get_the_post_format_media( 'audio', $post, 1 );
    37063706            if ( isset( $post->split_content ) )
    37073707                $split_content = $post->split_content;
    37083708            break;
    37093709        case 'video':
    3710             get_the_post_format_media( 'video', $post );
     3710            get_the_post_format_media( 'video', $post, 1 );
    37113711            if ( isset( $post->split_content ) )
    37123712                $split_content = $post->split_content;
Note: See TracChangeset for help on using the changeset viewer.