Changeset 24388 for trunk/wp-admin/edit-form-advanced.php
- Timestamp:
- 05/30/2013 09:33:46 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/edit-form-advanced.php
r24373 r24388 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 115 118 // all taxonomies 116 119 foreach ( get_object_taxonomies( $post ) as $tax_name ) { … … 125 128 else 126 129 add_meta_box($tax_name . 'div', $label, 'post_categories_meta_box', null, 'side', 'core', array( 'taxonomy' => $tax_name )); 127 }128 129 // post format130 $format_class = '';131 $post_format = '';132 $post_format_options = '';133 if ( post_type_supports( $post_type, 'post-formats' ) && apply_filters( 'enable_post_format_ui', true, $post ) ) {134 wp_enqueue_script( 'post-formats' );135 wp_enqueue_script( 'wp-mediaelement' );136 wp_enqueue_style( 'wp-mediaelement' );137 $post_format = get_post_format();138 139 if ( ! empty( $_REQUEST['format'] ) && in_array( $_REQUEST['format'], get_post_format_slugs() ) )140 $post_format = $_REQUEST['format'];141 142 if ( ! $post_format )143 $post_format = 'standard';144 145 $format_class = " class='wp-format-{$post_format}'";146 147 $all_post_formats = array(148 'standard' => array (149 'description' => __( 'Use the editor below to compose your post.' )150 ),151 'image' => array (152 'description' => __( 'Select or upload an image for your post.' )153 ),154 'gallery' => array (155 'description' => __( 'Use the Add Media button to select or upload images for your gallery.' )156 ),157 'link' => array (158 'description' => __( 'Add a link title and destination URL. Use the editor to compose optional text to accompany the link.' )159 ),160 'video' => array (161 'description' => __( 'Select or upload a video, or paste a video embed code into the box.' )162 ),163 'audio' => array (164 'description' => __( 'Select or upload an audio file, or paste an audio embed code into the box.' )165 ),166 'chat' => array (167 'description' => __( 'Copy a chat or Q&A transcript into the editor.' )168 ),169 'status' => array (170 'description' => __( 'Use the editor to compose a status update. What’s new?' )171 ),172 'quote' => array (173 'description' => __( 'Add a source name and link if you have them. Use the editor to compose the quote.' )174 ),175 'aside' => array (176 'description' => __( 'Use the editor to share a quick thought or side topic.' )177 )178 );179 180 foreach ( $all_post_formats as $slug => $attr ) {181 $class = '';182 if ( $post_format == $slug ) {183 $class = 'class="active"';184 $active_post_type_slug = $slug;185 }186 187 $url = add_query_arg( 'format', $slug );188 189 $post_format_options .= '<a ' . $class . ' href="' . esc_url( $url ) . '" data-description="' . $attr['description'] . '" data-wp-format="' . $slug . '" title="' . ucfirst( $slug ) . '"><div class="' . $slug . '"></div><span class="post-format-title">' . ucfirst( $slug ) . '</span></a>';190 }191 192 $current_post_format = array( 'currentPostFormat' => esc_html( $active_post_type_slug ) );193 wp_localize_script( 'post-formats', 'postFormats', $current_post_format );194 130 } 195 131 … … 380 316 <p><?php _e("You have lost your connection with the server, and saving has been disabled. This message will vanish once you've reconnected."); ?></p> 381 317 </div> 382 <?php if ( ! empty( $post_format_options ) ) : ?> 383 <div class="wp-post-format-ui"> 384 <div class="post-format-options"> 385 <?php echo $post_format_options; ?> 386 </div> 387 </div> 388 <?php endif; ?> 318 389 319 <form name="post" action="post.php" method="post" id="post"<?php do_action('post_edit_form_tag'); ?>> 390 320 <?php wp_nonce_field($nonce_action); ?> … … 412 342 <div id="poststuff"> 413 343 <div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>"> 414 <div id="post-body-content"<?php echo $format_class; ?>> 415 <?php if ( ! empty( $all_post_formats ) ) : ?> 416 <div class="wp-post-format-ui"> 417 <div class="post-format-change"><span class="icon <?php echo esc_attr( 'wp-format-' . $post_format ); ?>"></span> <span class="post-format-description"><?php echo $all_post_formats[$post_format]['description']; ?></span></div> 418 </div> 419 <?php endif; ?> 344 <div id="post-body-content"> 345 420 346 <?php if ( post_type_supports($post_type, 'title') ) { ?> 421 347 <div id="titlediv"> … … 457 383 } 458 384 459 // post format fields460 if ( post_type_supports( $post_type, 'post-formats' ) && apply_filters( 'enable_post_format_ui', true, $post ) )461 require_once( './includes/post-formats.php' );462 463 385 if ( post_type_supports($post_type, 'editor') ) { 464 386 ?> … … 468 390 'dfw' => true, 469 391 'tabfocus_elements' => 'insert-media-button,save-post', 470 'editor_height' => in_array( $post_format, array( 'status', 'aside' ) ) ? 120 : 360392 'editor_height' => 360, 471 393 ) ); ?> 472 394 <table id="post-status-info" cellspacing="0"><tbody><tr>
Note: See TracChangeset
for help on using the changeset viewer.