最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

block editor - Any way to get more space for editing post excerpts

programmeradmin1浏览0评论

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 badges
Add a comment  | 

2 Answers 2

Reset to default 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.

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?

发布评论

评论列表(0)

  1. 暂无评论