Ticket #19570: 19570.3.diff
File 19570.3.diff, 8.6 KB (added by , 12 years ago) |
---|
-
wp-includes/post.php
1899 1899 } 1900 1900 1901 1901 /** 1902 * Retrieve metadata for current post format 1903 * 1904 * @since 3.6.0 1905 * 1906 * @param int $post_id 1907 * @return null 1908 */ 1909 function get_post_format_meta( $post_id = 0 ) { 1910 $keys = get_post_custom( $post_id ); 1911 if ( empty( $keys ) ) 1912 return null; 1913 1914 $values = array(); 1915 foreach ( $keys as $key => $value ) { 1916 if ( 0 === strpos( $key, '_wp_format_' ) ) { 1917 $slug = str_replace( '_wp_format_', '', $key ); 1918 $values[$slug] = $value[0]; 1919 } 1920 } 1921 1922 return $values; 1923 } 1924 1925 /** 1902 1926 * Check if post is sticky. 1903 1927 * 1904 1928 * Sticky posts should remain at the top of The Loop. If the post ID is not -
wp-admin/includes/post.php
193 193 194 194 // Post Formats 195 195 if ( isset( $post_data['post_format'] ) ) { 196 if ( current_theme_supports( 'post-formats', $post_data['post_format'] ) ) 197 set_post_format( $post_ID, $post_data['post_format'] ); 198 elseif ( '0' == $post_data['post_format'] ) 199 set_post_format( $post_ID, false ); 196 set_post_format( $post_ID, $post_data['post_format'] ); 200 197 } 201 198 199 if ( isset( $post_data[ '_wp_format_url' ] ) ) { 200 update_post_meta( $post_ID, '_wp_format_url', addslashes( esc_url_raw( stripslashes( $post_data['_wp_format_url'] ) ) ) ); 201 } 202 203 $format_keys = array( 'quote', 'quote_source', 'image', 'gallery', 'media' ); 204 205 foreach ( $format_keys as $key ) { 206 if ( isset( $post_data[ '_wp_format_' . $key ] ) ) 207 update_post_meta( $post_ID, '_wp_format_' . $key, wp_filter_post_kses( $post_data[ '_wp_format_' . $key ] ) ); 208 } 209 202 210 // Meta Stuff 203 211 if ( isset($post_data['meta']) && $post_data['meta'] ) { 204 212 foreach ( $post_data['meta'] as $key => $value ) { -
wp-admin/js/post.js
791 791 }); 792 792 }); 793 793 } 794 795 // Post formats selection 796 $('.post-format-select a').on( 'click', function(e){ 797 e.preventDefault(); 798 var $this = $(this), 799 format = $this.data('wpFormat'); 800 $('.post-format-select a.nav-tab-active').removeClass('nav-tab-active'); 801 $this.addClass('nav-tab-active').blur(); 802 $('#post_format').val(format); 803 $('#post-body-content').attr('class', 'wp-format-' + format ); 804 }); 794 805 }); -
wp-admin/edit-form-advanced.php
112 112 add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', null, 'side', 'core' ); 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 ) { 120 117 $taxonomy = get_taxonomy($tax_name); … … 129 126 add_meta_box($tax_name . 'div', $label, 'post_categories_meta_box', null, 'side', 'core', array( 'taxonomy' => $tax_name )); 130 127 } 131 128 129 // post format 130 $post_format = get_post_format(); 131 $format_class = ''; 132 if ( ! $post_format && post_type_supports( $post_type, 'post-formats' ) ) 133 $post_format = 'standard'; 134 if ( $post_format ) 135 $format_class = " class='wp-format-{$post_format}'"; 136 132 137 if ( post_type_supports($post_type, 'page-attributes') ) 133 138 add_meta_box('pageparentdiv', 'page' == $post_type ? __('Page Attributes') : __('Attributes'), 'page_attributes_meta_box', null, 'side', 'core'); 134 139 … … 321 326 322 327 <div id="poststuff"> 323 328 329 <?php 330 if ( post_type_supports( $post_type, 'post-formats' ) ) { 331 $all_post_formats = get_post_format_strings(); 332 333 echo '<h2 class="nav-tab-wrapper post-format-select">'; 334 335 foreach ( $all_post_formats as $slug => $label ) { 336 if ( $post_format == $slug ) 337 $class = 'nav-tab nav-tab-active'; 338 else 339 $class = 'nav-tab'; 340 341 echo '<a class="' . $class . '" href="?format=' . $slug . '" data-wp-format="' . $slug . '">' . $label . '</a>'; 342 } 343 344 echo '</h2>'; 345 } 346 ?> 347 324 348 <div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>"> 325 <div id="post-body-content"> 349 <div id="post-body-content"<?php echo $format_class; ?>> 350 326 351 <?php if ( post_type_supports($post_type, 'title') ) { ?> 327 352 <div id="titlediv"> 328 353 <div id="titlewrap"> … … 356 381 357 382 do_action( 'edit_form_after_title' ); 358 383 384 // post format fields 385 if ( post_type_supports( $post_type, 'post-formats' ) ) { 386 $format_meta = get_post_format_meta( $post_ID ); 387 ?> 388 <div class="post-formats-fields"> 389 390 <input type="hidden" name="post_format" id="post_format" value="<?php echo esc_attr( $post_format ); ?>" /> 391 392 <div class="field wp-format-quote"> 393 <label for="_wp_format_quote" class="screen-reader-text"><?php _e( 'Quote' ); ?>:</label> 394 <textarea name="_wp_format_quote" placeholder="<?php _e( 'Quote' ); ?>" class="widefat"><?php echo esc_textarea( $format_meta['quote'] ); ?></textarea> 395 </div> 396 397 <div class="field wp-format-quote"> 398 <label for="_wp_format_quote_source" class="screen-reader-text"><?php _e( 'Quote source' ); ?>:</label> 399 <input type="text" name="_wp_format_quote_source" value="<?php echo esc_attr( $format_meta['quote_source'] ); ?>" placeholder="<?php _e( 'Quote source' ); ?>" class="widefat" /> 400 </div> 401 402 <div class="field wp-format-image"> 403 <label for="_wp_format_image" class="screen-reader-text"><?php _e( 'Image ID or URL' ); ?>:</label> 404 <input type="text" name="_wp_format_image" value="<?php echo esc_attr( $format_meta['image'] ); ?>" placeholder="<?php _e( 'Image ID or URL' ); ?>" class="widefat" /> 405 </div> 406 407 <div class="field wp-format-link wp-format-quote wp-format-image"> 408 <label for="_wp_format_url" class="screen-reader-text"><?php _e( 'Link URL' ); ?>:</label> 409 <input type="text" name="_wp_format_url" value="<?php echo esc_url( $format_meta['url'] ); ?>" placeholder="<?php _e( 'Link URL' ); ?>" class="widefat" /> 410 </div> 411 412 <div class="field wp-format-gallery"> 413 <label for="_wp_format_gallery" class="screen-reader-text"><?php _e( 'Gallery shortcode' ); ?>:</label> 414 <input type="text" name="_wp_format_gallery" value="<?php echo esc_attr( $format_meta['gallery'] ); ?>" placeholder="<?php _e( 'Gallery shortcode' ); ?>" class="widefat" /> 415 </div> 416 417 <div class="field wp-format-audio wp-format-video"> 418 <label for="_wp_format_media" class="screen-reader-text"><?php _e( 'Embed code or URL' ); ?>:</label> 419 <textarea name="_wp_format_media" placeholder="<?php _e( 'Embed code or URL' ); ?>" class="widefat"><?php echo esc_textarea( $format_meta['media'] ); ?></textarea> 420 </div> 421 422 </div> 423 <?php 424 } 425 359 426 if ( post_type_supports($post_type, 'editor') ) { 360 427 ?> 361 428 <div id="postdivrich" class="postarea"> -
wp-admin/css/wp-admin.css
750 750 background-color: #eee; 751 751 } 752 752 753 :-moz-placeholder { 753 :-moz-placeholder, 754 .wp-core-ui :-moz-placeholder { 754 755 color: #a9a9a9; 755 756 } 756 757 … … 3089 3090 margin: 2px 0 2px -2px; 3090 3091 } 3091 3092 3092 #post-status-select , #post-format{3093 #post-status-select { 3093 3094 line-height: 2.5em; 3094 3095 margin-top: 3px; 3095 3096 } 3096 3097 3098 /* Post formats form */ 3099 #poststuff .post-format-select { 3100 margin-top: 0; 3101 padding-bottom: 0; 3102 } 3103 3104 .post-formats-fields { 3105 margin-bottom: 20px; 3106 } 3107 3108 .wp-format-standard .post-formats-fields, 3109 .wp-format-aside .post-formats-fields, 3110 .wp-format-chat .post-formats-fields, 3111 .wp-format-status .post-formats-fields { 3112 display: none; 3113 } 3114 3115 .post-formats-fields .field { 3116 display: none; 3117 margin-bottom: 10px; 3118 } 3119 3120 .post-formats-fields input, 3121 .post-formats-fields textarea { 3122 padding: 5px; 3123 font-size: 1.2em; 3124 } 3125 3126 .wp-format-chat .field.wp-format-chat, 3127 .wp-format-gallery .field.wp-format-gallery, 3128 .wp-format-link .field.wp-format-link, 3129 .wp-format-image .field.wp-format-image, 3130 .wp-format-quote .field.wp-format-quote, 3131 .wp-format-video .field.wp-format-video, 3132 .wp-format-audio .field.wp-format-audio { 3133 display: block; 3134 } 3135 3136 /*.wp-format-image .post-formats-fields, 3137 .wp-format-video .post-formats-fields, 3138 .wp-format-audio .post-formats-fields { 3139 width: 30%; 3140 float: left; 3141 } 3142 3143 .wp-format-image #postdivrich, 3144 .wp-format-video #postdivrich, 3145 .wp-format-audio #postdivrich { 3146 width: 69%; 3147 float: right; 3148 }*/ 3149 3097 3150 /* Post Screen */ 3098 3151 #post-body #normal-sortables { 3099 3152 min-height: 50px;