Changeset 12350
- Timestamp:
- 12/09/2009 03:39:20 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/edit-form-advanced.php
r12343 r12350 99 99 100 100 add_meta_box('categorydiv', __('Categories'), 'post_categories_meta_box', 'post', 'side', 'core'); 101 if ( current_theme_supports( 'post-images' ) )101 if ( current_theme_supports( 'post-images', 'post' ) ) 102 102 add_meta_box('postimagediv', __('Post Image'), 'post_image_meta_box', 'post', 'side', 'low'); 103 103 add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', 'post', 'normal', 'core'); -
trunk/wp-admin/edit-page-form.php
r12343 r12350 81 81 add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', 'page', 'normal', 'core'); 82 82 add_meta_box('slugdiv', __('Page Slug'), 'post_slug_meta_box', 'page', 'normal', 'core'); 83 if ( current_theme_supports( 'post-images' ) )83 if ( current_theme_supports( 'post-images', 'page' ) ) 84 84 add_meta_box('postimagediv', __('Page Image'), 'post_image_meta_box', 'page', 'side', 'low'); 85 85 -
trunk/wp-admin/includes/media.php
r12344 r12350 1240 1240 1241 1241 $thumbnail = ''; 1242 if ( 'image' == $type && current_theme_supports( 'post-images') && get_post_image_id($_GET['post_id']) != $attachment_id )1242 if ( 'image' == $type && isset($_GET['post_id']) && current_theme_supports( 'post-images', get_post_type($_GET['post_id']) ) && get_post_image_id($_GET['post_id']) != $attachment_id ) 1243 1243 $thumbnail = "<a class='wp-post-thumbnail' href='#' onclick='WPSetAsThumbnail(\"$attachment_id\");return false;'>" . esc_html__( "Use as post image" ) . "</a>"; 1244 1244 -
trunk/wp-includes/theme.php
r12345 r12350 1321 1321 function add_theme_support( $feature ) { 1322 1322 global $_wp_theme_features; 1323 1323 1324 if ( 'post-thumbnails' == $feature ) // This was changed during 2.9 beta. I'll be nice and not break things. 1324 1325 $feature = 'post-images'; 1325 $_wp_theme_features[$feature] = true; 1326 1327 if ( func_num_args() == 1 ) 1328 $_wp_theme_features[$feature] = true; 1329 else 1330 $_wp_theme_features[$feature] = array_slice( func_get_args(), 1 ); 1326 1331 } 1327 1332 … … 1337 1342 function current_theme_supports( $feature ) { 1338 1343 global $_wp_theme_features; 1339 return ( isset( $_wp_theme_features[$feature] ) && $_wp_theme_features[$feature] ); 1344 1345 if ( !isset( $_wp_theme_features[$feature] ) ) 1346 return false; 1347 1348 // If no args passed then no extra checks need be performed 1349 if ( func_num_args() <= 1 ) 1350 return true; 1351 1352 $args = array_slice( func_get_args(), 1 ); 1353 1354 // @todo Allow pluggable arg checking 1355 switch ( $feature ) { 1356 case 'post-images': 1357 // post-thumbnails can be registered for only certain content/post types by passing 1358 // an array of types to add_theme_support(). If no array was passed, then 1359 // any type is accepted 1360 if ( true === $_wp_theme_features[$feature] ) // Registered for all types 1361 return true; 1362 $content_type = $args[0]; 1363 if ( in_array($content_type, $_wp_theme_features[$feature][0]) ) 1364 return true; 1365 else 1366 return false; 1367 break; 1368 } 1369 1370 return true; 1340 1371 } 1341 1372
Note: See TracChangeset
for help on using the changeset viewer.