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?
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?
Share Improve this question asked Jul 12, 2019 at 1:39 Craig ConstantineCraig Constantine 957 bronze badges2 Answers
Reset to default 1 +50I'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.
- Create an Admin CSS file in your child theme folder called
admin-style.css
- 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;
}
}
- 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.
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?