Skip to content

Commit

Permalink
Remove the excerpt management #114
Browse files Browse the repository at this point in the history
  • Loading branch information
markkap committed Apr 27, 2019
1 parent 857ec92 commit 674d737
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/wp-admin/edit-form-advanced.php
Expand Up @@ -254,7 +254,7 @@
);

if ( 'post' == $post_type ) {
$customize_display = '<p>' . __( 'The title field and the big Post Editing Area are fixed in place, but you can reposition all the other boxes using drag and drop. You can also minimize or expand them by clicking the title bar of each box. Use the Screen Options tab to unhide more boxes (Excerpt, Discussion, Slug, Author) or to choose a 1- or 2-column layout for this screen.' ) . '</p>';
$customize_display = '<p>' . __( 'The title field and the big Post Editing Area are fixed in place, but you can reposition all the other boxes using drag and drop. You can also minimize or expand them by clicking the title bar of each box. Use the Screen Options tab to unhide more boxes (Discussion, Slug, Author) or to choose a 1- or 2-column layout for this screen.' ) . '</p>';

get_current_screen()->add_help_tab(
array(
Expand Down
22 changes: 10 additions & 12 deletions src/wp-admin/includes/meta-boxes.php
Expand Up @@ -600,17 +600,19 @@ function post_categories_meta_box( $post, $box ) {
/**
* Display post excerpt form fields.
*
* For calmPress it is a backward compatibility shim that does noting unless
* the manual excerpt plugin is installed, in which case it calls the relevant function.
*
* @since 2.6.0
* @since calmPress 1.0.0
*
* @param object $post
* @param \WP_Post $post The post for which the excerpt is being modified.
*/
function post_excerpt_meta_box($post) {
?>
<label class="screen-reader-text" for="excerpt"><?php _e('Excerpt') ?></label><textarea rows="1" cols="40" name="excerpt" id="excerpt"><?php echo $post->post_excerpt; // textarea_escaped ?></textarea>
<p><?php
_e( 'Excerpts are optional hand-crafted summaries of your content that can be used in your theme.' );
?></p>
<?php
function post_excerpt_meta_box( \WP_Post $post ) {
if ( function_exists( '\calmpress\manualexcerpt\post_excerpt_meta_box' ) ) {
// If the manual excerpt core plugin is installed, just pass control to it.
\calmpress\manualexcerpt\post_excerpt_meta_box( $post );
}
}

/**
Expand Down Expand Up @@ -964,10 +966,6 @@ function register_and_do_post_meta_boxes( $post ) {
add_meta_box( 'postimagediv', esc_html( $post_type_object->labels->featured_image ), 'post_thumbnail_meta_box', null, 'side', 'low', array( '__back_compat_meta_box' => true ) );
}

if ( post_type_supports( $post_type, 'excerpt' ) ) {
add_meta_box( 'postexcerpt', __( 'Excerpt' ), 'post_excerpt_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) );
}

/**
* Fires in the middle of built-in meta box registration.
*
Expand Down
13 changes: 6 additions & 7 deletions src/wp-includes/post.php
Expand Up @@ -1291,7 +1291,7 @@ function get_post_types( $args = array(), $output = 'names', $operator = 'and' )
* Default false.
* @type array $supports Core feature(s) the post type supports. Serves as an alias for calling
* add_post_type_support() directly. Core features include 'title',
* 'editor', 'comments', 'revisions', 'author', 'excerpt',
* 'editor', 'comments', 'revisions', 'author',
* 'page-attributes', 'thumbnail'.
* Additionally, the 'revisions' feature dictates whether the post type
* will store revisions, and the 'comments' feature dictates whether the
Expand Down Expand Up @@ -1746,7 +1746,7 @@ function _add_post_type_submenus() {
*
* All core features are directly associated with a functional area of the edit
* screen, such as the editor or a meta box. Features include: 'title', 'editor',
* 'comments', 'revisions', 'author', 'excerpt', 'page-attributes',
* 'comments', 'revisions', 'author', 'page-attributes',
* 'thumbnail', 'custom-fields'.
*
* Additionally, the 'revisions' feature dictates whether the post type will
Expand Down Expand Up @@ -3441,15 +3441,14 @@ function wp_insert_post( $postarr, $wp_error = false ) {
$maybe_empty = 'attachment' !== $post_type
&& ! $post_content && ! $post_title && ! $post_excerpt
&& post_type_supports( $post_type, 'editor' )
&& post_type_supports( $post_type, 'title' )
&& post_type_supports( $post_type, 'excerpt' );
&& post_type_supports( $post_type, 'title' );

/**
* Filters whether the post should be considered "empty".
*
* The post is considered "empty" if both:
* 1. The post type supports the title, editor, and excerpt fields
* 2. The title, editor, and excerpt fields are all empty
* 1. The post type supports the title and editor fields
* 2. The title and editor fields are empty
*
* Returning a truthy value to the filter will effectively short-circuit
* the new post being inserted, returning 0. If $wp_error is true, a WP_Error
Expand All @@ -3462,7 +3461,7 @@ function wp_insert_post( $postarr, $wp_error = false ) {
*/
if ( apply_filters( 'wp_insert_post_empty_content', $maybe_empty, $postarr ) ) {
if ( $wp_error ) {
return new WP_Error( 'empty_content', __( 'Content, title, and excerpt are empty.' ) );
return new WP_Error( 'empty_content', __( 'Content and title are empty.' ) );
} else {
return 0;
}
Expand Down

0 comments on commit 674d737

Please sign in to comment.