Implement theme support for structured-post-formats, which will supercede theme support for post-formats. Usage is the same as declaring support for post-formats: `add_theme_support( 'structured-post-formats', array( 'quote', 'video' ) )`. Adding `structured-post-formats` support also adds `post-formats` support for the given format(s) underneath.

Declaring support for a given format indicates that the theme handles format-specific metadata; admin UI will not change based on theme-declared support of either variety as it did previously. If no `structured-post-formats` support is explicitly declared for a format, a post in that format will have fallback output utilizing that metadata applied. In this way, a theme can style core-provided output for a full post format experience without having to handle metadata in any way.

props nacin. see #23347.


git-svn-id: https://develop.svn.wordpress.org/trunk@23467 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Helen Hou-Sandi 2013-02-21 22:48:09 +00:00
parent e1b603bbc3
commit e599566ce4
1 changed files with 10 additions and 1 deletions

View File

@ -1257,9 +1257,17 @@ function add_theme_support( $feature ) {
$args = array_slice( func_get_args(), 1 );
switch ( $feature ) {
case 'post-formats' :
case 'structured-post-formats' :
if ( is_array( $args[0] ) )
$args[0] = array_intersect( $args[0], array_keys( get_post_format_slugs() ) );
// structured-post-formats support automatically adds support for post-formats.
$_wp_theme_features['post-formats'] = $args;
case 'post-formats' :
// An existing structured-post-formats support declaration overrides post-formats.
if ( current_theme_supports( 'structured-post-formats' ) )
$args = get_theme_support( 'structured-post-formats' );
elseif ( is_array( $args[0] ) )
$args[0] = array_intersect( $args[0], array_keys( get_post_format_slugs() ) );
break;
case 'custom-header-uploads' :
@ -1545,6 +1553,7 @@ function current_theme_supports( $feature ) {
return in_array( $content_type, $_wp_theme_features[$feature][0] );
break;
case 'structured-post-formats':
case 'post-formats':
// specific post formats can be registered by passing an array of types to
// add_theme_support()