Changeset 23449 for trunk/wp-admin/edit-form-advanced.php
- Timestamp:
- 02/18/2013 07:11:24 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/edit-form-advanced.php
r23416 r23449 113 113 } 114 114 115 if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) )116 add_meta_box( 'formatdiv', _x( 'Format', 'post format' ), 'post_format_meta_box', null, 'side', 'core' );117 118 115 // all taxonomies 119 116 foreach ( get_object_taxonomies( $post ) as $tax_name ) { … … 128 125 else 129 126 add_meta_box($tax_name . 'div', $label, 'post_categories_meta_box', null, 'side', 'core', array( 'taxonomy' => $tax_name )); 127 } 128 129 // post format 130 if ( post_type_supports( $post_type, 'post-formats' ) ) { 131 wp_enqueue_script( 'post-formats' ); 132 $post_format = get_post_format(); 133 $format_class = ''; 134 if ( ! $post_format ) 135 $post_format = 'standard'; 136 137 $format_class = " class='wp-format-{$post_format}'"; 130 138 } 131 139 … … 322 330 <div id="poststuff"> 323 331 332 <?php 333 if ( post_type_supports( $post_type, 'post-formats' ) ) { 334 $all_post_formats = get_post_format_strings(); 335 336 echo '<h2 class="nav-tab-wrapper post-format-select">'; 337 338 foreach ( $all_post_formats as $slug => $label ) { 339 if ( $post_format == $slug ) 340 $class = 'nav-tab nav-tab-active'; 341 else 342 $class = 'nav-tab'; 343 344 echo '<a class="' . $class . '" href="?format=' . $slug . '" data-wp-format="' . $slug . '">' . $label . '</a>'; 345 } 346 347 echo '</h2>'; 348 } 349 ?> 350 324 351 <div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>"> 325 <div id="post-body-content"> 352 <div id="post-body-content"<?php echo $format_class; ?>> 353 326 354 <?php if ( post_type_supports($post_type, 'title') ) { ?> 327 355 <div id="titlediv"> … … 356 384 357 385 do_action( 'edit_form_after_title' ); 386 387 // post format fields 388 if ( post_type_supports( $post_type, 'post-formats' ) ) { 389 $format_meta = get_post_format_meta( $post_ID ); 390 391 if ( isset( $format_meta['image'] ) ) 392 $image = is_numeric( $format_meta['image'] ) ? wp_get_attachment_url( $format_meta['image'] ) : $format_meta['image']; 393 else 394 $image = false; 395 ?> 396 <div class="post-formats-fields"> 397 398 <input type="hidden" name="post_format" id="post_format" value="<?php echo esc_attr( $post_format ); ?>" /> 399 400 <div class="field wp-format-quote"> 401 <label for="_wp_format_quote" class="screen-reader-text"><?php _e( 'Quote' ); ?>:</label> 402 <textarea name="_wp_format_quote" placeholder="<?php esc_attr_e( 'Quote' ); ?>" class="widefat"><?php echo esc_textarea( $format_meta['quote'] ); ?></textarea> 403 </div> 404 405 <div class="field wp-format-quote"> 406 <label for="_wp_format_quote_source" class="screen-reader-text"><?php _e( 'Quote source' ); ?>:</label> 407 <input type="text" name="_wp_format_quote_source" value="<?php echo esc_attr( $format_meta['quote_source'] ); ?>" placeholder="<?php esc_attr_e( 'Quote source' ); ?>" class="widefat" /> 408 </div> 409 410 <div class="field wp-format-image"> 411 <div id="wp-format-image-holder" class="hide-if-no-js<?php if ( ! $image ) echo ' empty'; ?>"> 412 <a href="#" id="wp-format-image-select" 413 data-choose="<?php esc_attr_e( 'Choose an Image' ); ?>" 414 data-update="<?php esc_attr_e( 'Select Image' ); ?>"> 415 <?php 416 if ( $image ) 417 echo '<img src="' . esc_url( $image ) . '" />'; 418 else 419 _e( 'Select Image' ); 420 ?> 421 </a> 422 </div> 423 <label for="_wp_format_image" class="screen-reader-text"><?php _e( 'Image ID or URL' ); ?>:</label> 424 <input type="text" name="_wp_format_image" id="wp_format_image" value="<?php echo esc_attr( $format_meta['image'] ); ?>" placeholder="<?php esc_attr_e( 'Image ID or URL' ); ?>" class="widefat hide-if-js" /> 425 </div> 426 427 <div class="field wp-format-link wp-format-quote wp-format-image"> 428 <label for="_wp_format_url" class="screen-reader-text"><?php _e( 'Link URL' ); ?>:</label> 429 <input type="text" name="_wp_format_url" value="<?php echo esc_url( $format_meta['url'] ); ?>" placeholder="<?php esc_attr_e( 'Link URL' ); ?>" class="widefat" /> 430 </div> 431 432 <div class="field wp-format-gallery"> 433 <label for="_wp_format_gallery" class="screen-reader-text"><?php _e( 'Gallery shortcode' ); ?>:</label> 434 <input type="text" name="_wp_format_gallery" id="wp_format_gallery" value="<?php echo esc_attr( $format_meta['gallery'] ); ?>" placeholder="<?php esc_attr_e( 'Gallery shortcode' ); ?>" class="widefat" /> 435 </div> 436 437 <div class="field wp-format-audio wp-format-video"> 438 <label for="_wp_format_media" class="screen-reader-text"><?php _e( 'Embed code or URL' ); ?>:</label> 439 <textarea name="_wp_format_media" placeholder="<?php esc_attr_e( 'Embed code or URL' ); ?>" class="widefat"><?php echo esc_textarea( $format_meta['media'] ); ?></textarea> 440 </div> 441 442 </div> 443 <?php 444 } 358 445 359 446 if ( post_type_supports($post_type, 'editor') ) {
Note: See TracChangeset
for help on using the changeset viewer.