mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@31550 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
89120dbb92
commit
f11e86fb83
@ -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>';
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user