Make WordPress Core

Changeset 23753


Ignore:
Timestamp:
03/19/2013 05:18:07 PM (14 years ago)
Author:
helen
Message:

Remove separate meta fields for image and gallery post formats. These are proving to be more confusing and labor-intensive from both a user and dev perspective than entering into the regular content editor. We will rely on good content parsing instead. See #19570, #23347.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/css/wp-admin.css

    r23727 r23753  
    30983098}
    30993099
    3100 .wp-format-standard .post-formats-fields,
    3101 .wp-format-aside .post-formats-fields,
    3102 .wp-format-chat .post-formats-fields,
    3103 .wp-format-status .post-formats-fields {
     3100.post-formats-fields {
    31043101        display: none;
     3102}
     3103
     3104.wp-format-link .post-formats-fields,
     3105.wp-format-quote .post-formats-fields,
     3106.wp-format-video .post-formats-fields,
     3107.wp-format-audio .post-formats-fields,
     3108.wp-format-chat .field.wp-format-chat,
     3109.wp-format-link .field.wp-format-link,
     3110.wp-format-quote .field.wp-format-quote,
     3111.wp-format-video .field.wp-format-video,
     3112.wp-format-audio .field.wp-format-audio {
     3113        display: block;
    31053114}
    31063115
    … …  
    31143123        padding: 5px;
    31153124        font-size: 1.2em;
    3116 }
    3117 
    3118 .wp-format-chat .field.wp-format-chat,
    3119 .wp-format-gallery .field.wp-format-gallery,
    3120 .wp-format-link .field.wp-format-link,
    3121 .wp-format-image .field.wp-format-image,
    3122 .wp-format-quote .field.wp-format-quote,
    3123 .wp-format-video .field.wp-format-video,
    3124 .wp-format-audio .field.wp-format-audio {
    3125         display: block;
    3126 }
    3127 
    3128 #wp-format-image-holder {
    3129         overflow: hidden;
    3130         width: 300px;
    3131         height: 200px;
    3132         border: 1px solid #dfdfdf;
    3133         background: #f5f5f5;
    3134 }
    3135 
    3136 #wp-format-image-holder:hover {
    3137         background-color: #eee;
    3138 }
    3139 
    3140 #wp-format-image-select {
    3141         display: block;
    3142         height: 200px;
    3143         text-align: center;
    3144 }
    3145 
    3146 #wp-format-image-select img {
    3147         max-width: 100%;
    3148         max-height: 100%;
    3149 }
    3150 
    3151 .empty #wp-format-image-select {
    3152         padding-top: 120px;
    3153         height: 80px;
    3154         background: url(../images/media-button-2x.png) no-repeat center;
    31553125}
    31563126
  • trunk/wp-admin/edit-form-advanced.php

    r23683 r23753  
    394394if ( post_type_supports( $post_type, 'post-formats' ) ) {
    395395        $format_meta = get_post_format_meta( $post_ID );
    396 
    397 if ( isset( $format_meta['image'] ) )
    398         $image = is_numeric( $format_meta['image'] ) ? wp_get_attachment_url( $format_meta['image'] ) : $format_meta['image'];
    399 else
    400         $image = false;
    401396?>
    402397<div class="post-formats-fields edit-form-section">
    … …  
    414409</div>
    415410
    416 <div class="field wp-format-image">
    417         <div id="wp-format-image-holder" class="hide-if-no-js<?php if ( ! $image ) echo ' empty'; ?>">
    418                 <a href="#" id="wp-format-image-select"
    419                         data-choose="<?php esc_attr_e( 'Choose an Image' ); ?>"
    420                         data-update="<?php esc_attr_e( 'Select Image' ); ?>">
    421                         <?php
    422                                 if ( $image )
    423                                         echo '<img src="' . esc_url( $image ) . '" />';
    424                                 else
    425                                         _e( 'Select Image' );
    426                         ?>
    427                 </a>
    428         </div>
    429         <label for="_wp_format_image" class="screen-reader-text"><?php _e( 'Image ID or URL' ); ?>:</label>
    430         <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" />
    431 </div>
    432 
    433 <div class="field wp-format-link wp-format-quote wp-format-image">
     411<div class="field wp-format-link wp-format-quote">
    434412        <label for="_wp_format_url" class="screen-reader-text"><?php _e( 'Link URL' ); ?>:</label>
    435413        <input type="text" name="_wp_format_url" value="<?php echo esc_url( $format_meta['url'] ); ?>" placeholder="<?php esc_attr_e( 'Link URL' ); ?>" class="widefat" />
    436 </div>
    437 
    438 <div class="field wp-format-gallery">
    439         <label for="_wp_format_gallery" class="screen-reader-text"><?php _e( 'Gallery shortcode' ); ?>:</label>
    440         <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" />
    441414</div>
    442415
  • trunk/wp-admin/js/post-formats.js

    r23730 r23753  
    1 window.wp = window.wp || {};
    2 
    31(function($){
    4         var imageFrame;
    52
    63        // Post formats selection
    74        $('.post-format-select a').on( 'click.post-format', function(e) {
    8                 var $this = $(this), editor, body,
    9                         format = $this.data('wp-format'), container = $('#post-body-content');
     5                var $this = $(this),
     6                        editor,
     7                        body,
     8                        format = $this.data('wp-format'),
     9                        container = $('#post-body-content');
    1010
    1111                $('.post-format-select a.nav-tab-active').removeClass('nav-tab-active');
    … …  
    2929        });
    3030
    31         // Image selection
    32         $('#wp-format-image-select').click( function( event ) {
    33                 var $el = $(this),
    34                         $holder = $('#wp-format-image-holder'),
    35                         $field = $('#wp_format_image');
    36                 event.preventDefault();
    37 
    38                 // If the media frame already exists, reopen it.
    39                 if ( imageFrame ) {
    40                         imageFrame.open();
    41                         return;
    42                 }
    43 
    44                 // Create the media frame.
    45                 imageFrame = wp.media.frames.formatImage = wp.media({
    46                         // Set the title of the modal.
    47                         title: $el.data('choose'),
    48 
    49                         // Tell the modal to show only images.
    50                         library: {
    51                                 type: 'image'
    52                         },
    53 
    54                         // Customize the submit button.
    55                         button: {
    56                                 // Set the text of the button.
    57                                 text: $el.data('update')
    58                         }
    59                 });
    60 
    61                 // When an image is selected, run a callback.
    62                 imageFrame.on( 'select', function() {
    63                         // Grab the selected attachment.
    64                         var attachment = imageFrame.state().get('selection').first(),
    65                                 imageUrl = attachment.get('url');
    66 
    67                         // set the hidden input's value
    68                         $field.attr('value', attachment.id);
    69 
    70                         // Show the image in the placeholder
    71                         $el.html('<img src="' + imageUrl + '" />');
    72                         $holder.removeClass('empty');
    73                 });
    74 
    75                 imageFrame.open();
    76         });
    7731})(jQuery);
  • trunk/wp-includes/post-formats.php

    r23729 r23753  
    8484                'quote'        => '',
    8585                'quote_source' => '',
    86                 'image'        => '',
    8786                'url'          => '',
    88                 'gallery'      => '',
    8987                'media'        => '',
    9088        );
    … …  
    300298                'class' => get_post_format_content_class( $format ),
    301299                'link_class' => '',
    302                 'image_class' => '',
    303300        );
    304301
    … …  
    344341                        break;
    345342
    346                 case 'image':
    347                         if ( ! empty( $meta['image'] ) ) {
    348                                 $image = is_numeric( $meta['image'] ) ? wp_get_attachment_url( $meta['image'] ) : $meta['image'];
    349 
    350                                 if ( ! empty( $image ) && ! stristr( $content, $image ) ) {
    351                                         $image_html = sprintf(
    352                                                 '<img %ssrc="%s" alt="" />',
    353                                                 empty( $compat['image_class'] ) ? '' : sprintf( 'class="%s" ', esc_attr( $compat['image_class'] ) ),
    354                                                 $image
    355                                         );
    356                                         if ( empty( $meta['url'] ) ) {
    357                                                 $format_output .= $image_html;
    358                                         } else {
    359                                                 $format_output .= sprintf(
    360                                                         '<a href="%s">%s</a>',
    361                                                         esc_url( $meta['url'] ),
    362                                                         $image_html
    363                                                 );
    364                                         }
    365                                 }
    366                         }
    367                         break;
    368 
    369                 case 'gallery':
    370                         if ( ! has_shortcode( $post->post_content, $format ) && ! empty( $meta['gallery'] ) )
    371                                 $format_output .= $meta['gallery'];
    372                         break;
    373 
    374343                case 'video':
    375344                case 'audio':
Note: See TracChangeset for help on using the changeset viewer.