WordPress.org

Make WordPress Core

Changeset 24373


Ignore:
Timestamp:
05/27/13 01:02:10 (11 months ago)
Author:
SergeyBiryukov
Message:

Fix switching post formats when JavaScript is disabled. props kovshenin. see #24360.

Location:
trunk/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-header.php

    r24282 r24373  
    8888if ( isset( $post ) && is_a( $post, 'WP_Post' ) && post_type_supports( get_post_type(), 'post-formats' ) ) { 
    8989    $post_format = get_post_format(); 
    90     if ( ! $post_format ) { 
     90 
     91    if ( ! empty( $_REQUEST['format'] ) && in_array( $_REQUEST['format'], get_post_format_slugs() ) ) 
     92        $post_format = $_REQUEST['format']; 
     93 
     94    if ( ! $post_format ) 
    9195        $post_format = 'standard'; 
    92  
    93         if ( ! empty( $_REQUEST['format'] ) && in_array( $_REQUEST['format'], get_post_format_slugs() ) ) 
    94             $post_format = $_REQUEST['format']; 
    95     } 
    9696 
    9797    $admin_body_class .= ' wp-format-' . $post_format; 
  • trunk/wp-admin/edit-form-advanced.php

    r24264 r24373  
    137137    $post_format = get_post_format(); 
    138138 
    139     if ( ! $post_format ) { 
     139    if ( ! empty( $_REQUEST['format'] ) && in_array( $_REQUEST['format'], get_post_format_slugs() ) ) 
     140        $post_format = $_REQUEST['format']; 
     141 
     142    if ( ! $post_format ) 
    140143        $post_format = 'standard'; 
    141  
    142         if ( ! empty( $_REQUEST['format'] ) && in_array( $_REQUEST['format'], get_post_format_slugs() ) ) 
    143             $post_format = $_REQUEST['format']; 
    144     } 
    145144 
    146145    $format_class = " class='wp-format-{$post_format}'"; 
     
    186185        } 
    187186 
    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>'; 
     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>'; 
    189190    } 
    190191 
Note: See TracChangeset for help on using the changeset viewer.