1

Using latest WP with Gutenberg. The excerpt metabox is (as you'd expect) over in the right column with the Document settings.

Is there any way to get it out of that column and into the main area where the textarea would then be of a useful size?

2 Answers 2

1

Depending on the context, in which you would like to make these changes, I'd simply remove the metabox from that certain post type. Then add another metabox above the editor for your excerpt box.

The downside: you can not use get_the_excerpt, the_excerpt etc. anymore because that metabox doesn't exist any more.

Have a look at this post

How can I put a custom meta box above the editor but below the title section on the edit post page?

1
+50

I'm not sure how to move the Excerpt field into the main block editor area, but you can get a much wider and more usable Excerpt field by adding a few admin CSS rules that widen the edit-post-sidebar on hover.

The solution below widens the sidebar by up to 300% when you hover over it.

  1. Create an Admin CSS file in your child theme folder called admin-style.css
  2. Add custom CSS to your new file

Add to admin-style.css

/*
For larger viewports, widen the edit post sidebar when hovered over
*/
@media screen and (min-width: 782px) {
    .edit-post-layout.is-sidebar-opened .edit-post-sidebar:hover {
        width: 700px;
        max-width: 50vw;
        transition: all ease .7s;
    }
}
  1. Enqueue admin style by placing this code in functions.php

Add to functions.php

// Enqueue custom admin style sheet
function load_custom_wp_admin_style() {
    wp_register_style( 'custom_wp_admin_css', get_stylesheet_directory_uri() . '/admin-style.css' );
    wp_enqueue_style( 'custom_wp_admin_css' );
}
add_action( 'admin_enqueue_scripts', 'load_custom_wp_admin_style' );

By using admin_enqueue_scripts, this file is only loaded on the admin side and will not impact the publicly-visible frontend of your website.

3
  • That's a nice tweak. like it. Commented Nov 20, 2019 at 21:16
  • this is a really nice tweak. Particularly with the clear instrux how to correctly enqueue the admin CSS. Commented Nov 25, 2019 at 22:37
  • Glad you like it. This admin-style comes in handy for other admin tweaks too. Commented Nov 26, 2019 at 2:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.