WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/17/2013 03:12:50 PM (6 years ago)
Author:
ryan
Message:

Display the post format UI when there is structured data associated with the post regardless of the screen option.

Props kovshenin
see #24327

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-header.php

    r24264 r24282  
    108108        else
    109109            $show_post_format_ui = current_theme_supports( 'post-formats' ) || (bool) get_terms( 'post_format', array( 'number' => 1 ) );
     110
     111        if ( ! $show_post_format_ui ) {
     112            $meta = get_post_format_meta( $post->ID );
     113            $format_meta_keys = array(
     114                'link'  => array( 'linkurl' ),
     115                'image' => array( 'url', 'image' ),
     116                'quote' => array( 'quote_source_name', 'quote_source_url' ),
     117                'video' => array( 'video_embed' ),
     118                'audio' => array( 'audio_embed' ),
     119            );
     120
     121            // If there's any structured post format data, enforce the UI display.
     122            $format_meta_keys = isset( $format_meta_keys[ get_post_format() ] ) ? $format_meta_keys[ get_post_format() ] : array();
     123            foreach ( $format_meta_keys as $key )
     124                if ( ! empty( $meta[ $key ] ) )
     125                    $show_post_format_ui = true;
     126        }
    110127    }
    111128
Note: See TracChangeset for help on using the changeset viewer.