Make WordPress Core


Ignore:
Timestamp:
04/17/2013 04:08:46 AM (11 years ago)
Author:
markjaquith
Message:

New Post Format UI chooser treatment in response to testing.

  • Bigger icons
  • Format description under each
  • UI hides after choice
  • Saving without choosing implies "Standard"
  • Helpful text, with "Change format" link

see #24046. props lessbloat, wonderboymusic.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit-form-advanced.php

    r23993 r24006  
    134134    wp_enqueue_style( 'wp-mediaelement' );
    135135    $post_format = get_post_format();
    136 
    137     if ( ! $post_format )
     136    $post_format_set_class = 'post-format-set';
     137
     138    if ( ! $post_format ) {
    138139        $post_format = 'standard';
     140        if ( 'auto-draft' == $post->post_status )
     141            $post_format_set_class = '';
     142    }
    139143
    140144    $format_class = " class='wp-format-{$post_format}'";
     
    143147    $all_post_formats = array(
    144148        'standard' => array (
    145             'description' => __( 'Add a title and use the editor to compose your post.' )
     149            'description' => __( 'Use the editor below to compose your post.' )
    146150        ),
    147151        'image' => array (
    148             'description' => __( 'Select or upload an image to use for your post.' )
     152            'description' => __( 'Select or upload an image for your post.' )
    149153        ),
    150154        'gallery' => array (
     
    167171        ),
    168172        'quote' => array (
    169             'description' => __( 'Copy a quotation into the box. Also add the source and URL if you have them.' )
     173            'description' => __( 'Copy a quotation into the box below. Add a source and URL if you have them.' )
    170174        ),
    171175        'aside' => array (
    172             'description' => __( 'An aside is a quick thought or side topic. Use the editor to compose one.' )
     176            'description' => __( 'Use the editor to share a quick thought or side topic.' )
    173177        )
    174178    );
     
    182186        }
    183187
    184         $post_format_options .= '<a ' . $class . ' href="?format=' . $slug . '" data-description="' . $attr['description'] . '" data-wp-format="' . $slug . '" title="' . ucfirst( sprintf( __( '%s Post' ), $slug ) ) . '"><div class="' . $slug . '"></div></a>';
     188        $post_format_options .= '<a ' . $class . ' href="?format=' . $slug . '" data-description="' . $attr['description'] . '" data-wp-format="' . $slug . '" title="' . ucfirst( $slug ) . '"><div class="' . $slug . '"></div><span class="post-format-title">' . ucfirst( $slug ) . '</span></a>';
    185189    }
    186190
     
    359363?>
    360364
    361 <div class="wrap">
     365<div class="wrap <?php echo $post_format_set_class; ?>">
    362366<?php screen_icon(); ?>
    363367<h2><?php
     
    375379    <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>
    376380</div>
     381<?php if ( ! empty( $post_format_options ) ) : ?>
     382<div class="post-format-options">
     383    <?php echo $post_format_options; ?>
     384</div>
     385<?php endif; ?>
    377386<form name="post" action="post.php" method="post" id="post"<?php do_action('post_edit_form_tag'); ?>>
    378387<?php wp_nonce_field($nonce_action); ?>
     
    401410<div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
    402411<div id="post-body-content"<?php echo $format_class; ?>>
    403 
    404 <?php if ( ! empty( $post_format_options ) ) : ?>
    405 <div class="post-format-options">
    406     <span class="post-format-tip">Standard Post</span>
    407     <?php echo $post_format_options; ?>
    408 </div>
    409 <?php endif; ?>
    410 
    411412<?php if ( post_type_supports($post_type, 'title') ) { ?>
    412413<div id="titlediv">
     
    425426    $has_sample_permalink = $sample_permalink_html && 'auto-draft' != $post->post_status;
    426427?>
    427     <div id="edit-slug-box" class="hide-if-no-js<?php if ( ! $has_sample_permalink ) echo ' hidden' ?>">
     428    <div id="edit-slug-box" class="hide-if-no-js">
    428429    <?php
    429430        if ( $has_sample_permalink )
Note: See TracChangeset for help on using the changeset viewer.