Hide irrelevant UI and display a message when editing the page for posts.
Users are frequently confused as to why the content they've entered or the page template they've selected doesn't apply for this one page. Showing and saving items that don't do anything hurts trust. Developers can elect to turn on the editor should they be using it for something. If the content isn't empty, the editor will show so that users still have access to their content. props alexkingorg for the initial, long-suffering patch. fixes #17470. Built from https://develop.svn.wordpress.org/trunk@31550 git-svn-id: http://core.svn.wordpress.org/trunk@31531 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
9e7561a8d4
commit
ae3baa7c5b
|
@ -45,6 +45,11 @@ $post_ID = isset($post_ID) ? (int) $post_ID : 0;
|
|||
$user_ID = isset($user_ID) ? (int) $user_ID : 0;
|
||||
$action = isset($action) ? $action : '';
|
||||
|
||||
if ( $post_ID == get_option( 'page_for_posts' ) && empty( $post->post_content ) ) {
|
||||
add_action( 'edit_form_after_title', '_wp_posts_page_notice' );
|
||||
remove_post_type_support( $post_type, 'editor' );
|
||||
}
|
||||
|
||||
$thumbnail_support = current_theme_supports( 'post-thumbnails', $post_type ) && post_type_supports( $post_type, 'thumbnail' );
|
||||
if ( ! $thumbnail_support && 'attachment' === $post_type && $post->post_mime_type ) {
|
||||
if ( 0 === strpos( $post->post_mime_type, 'audio/' ) ) {
|
||||
|
|
|
@ -739,7 +739,7 @@ function page_attributes_meta_box($post) {
|
|||
<?php
|
||||
} // end empty pages check
|
||||
} // end hierarchical check.
|
||||
if ( 'page' == $post->post_type && 0 != count( get_page_templates( $post ) ) ) {
|
||||
if ( 'page' == $post->post_type && 0 != count( get_page_templates( $post ) ) && get_option( 'page_for_posts' ) != $post->ID ) {
|
||||
$template = !empty($post->page_template) ? $post->page_template : false;
|
||||
?>
|
||||
<p><strong><?php _e('Template') ?></strong></p>
|
||||
|
|
|
@ -2169,3 +2169,12 @@ function wp_star_rating( $args = array() ) {
|
|||
echo str_repeat( '<div class="star star-empty"></div>', $empty_stars);
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Output a notice when editing the page for posts.
|
||||
*
|
||||
* @since 4.2.0
|
||||
*/
|
||||
function _wp_posts_page_notice() {
|
||||
echo '<div class="notice notice-warning inline"><p>' . __( 'You are currently editing the page that shows your latest posts.' ) . '</p></div>';
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.2-alpha-31549';
|
||||
$wp_version = '4.2-alpha-31550';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue