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

git-svn-id: http://core.svn.wordpress.org/trunk@24373 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2013-05-27 01:02:10 +00:00
parent 86dd4f184c
commit 8faa6f0260
2 changed files with 12 additions and 11 deletions

View File

@ -87,12 +87,12 @@ $admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace(
if ( isset( $post ) && is_a( $post, 'WP_Post' ) && post_type_supports( get_post_type(), 'post-formats' ) ) {
$post_format = get_post_format();
if ( ! $post_format ) {
$post_format = 'standard';
if ( ! empty( $_REQUEST['format'] ) && in_array( $_REQUEST['format'], get_post_format_slugs() ) )
$post_format = $_REQUEST['format'];
}
if ( ! $post_format )
$post_format = 'standard';
$admin_body_class .= ' wp-format-' . $post_format;

View File

@ -136,12 +136,11 @@ if ( post_type_supports( $post_type, 'post-formats' ) && apply_filters( 'enable_
wp_enqueue_style( 'wp-mediaelement' );
$post_format = get_post_format();
if ( ! $post_format ) {
$post_format = 'standard';
if ( ! empty( $_REQUEST['format'] ) && in_array( $_REQUEST['format'], get_post_format_slugs() ) )
$post_format = $_REQUEST['format'];
}
if ( ! $post_format )
$post_format = 'standard';
$format_class = " class='wp-format-{$post_format}'";
@ -185,7 +184,9 @@ if ( post_type_supports( $post_type, 'post-formats' ) && apply_filters( 'enable_
$active_post_type_slug = $slug;
}
$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>';
$url = add_query_arg( 'format', $slug );
$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>';
}
$current_post_format = array( 'currentPostFormat' => esc_html( $active_post_type_slug ) );