javascript - Adding a text element in between title and blocks container

admin2025-06-03  2

Is it possible to add an additional text input before the Blocks editor? I'm trying to update my Subtitle plugin to be Gutenberg compatible, but the subtitle isn't really a "Block" and I think it's more similar to the page title.

Pre-WordPress 5.0, I used the edit_form_after_title hook, but in Gutenberg that's irrelevant, so I'm wondering how to inject a new, non-block, element?

Plugin in question: KIA Subtitle

Is it possible to add an additional text input before the Blocks editor? I'm trying to update my Subtitle plugin to be Gutenberg compatible, but the subtitle isn't really a "Block" and I think it's more similar to the page title.

Pre-WordPress 5.0, I used the edit_form_after_title hook, but in Gutenberg that's irrelevant, so I'm wondering how to inject a new, non-block, element?

Plugin in question: KIA Subtitle

Share Improve this question edited Feb 9, 2019 at 0:06 helgatheviking asked Feb 7, 2019 at 19:19 helgathevikinghelgatheviking 14.5k8 gold badges64 silver badges115 bronze badges 15
  • 1 I'm afraid it's not possible. You can add it as metabox or use custom template for blocks that will put your custom block as first always. – Krzysiek Dróżdż Commented Feb 7, 2019 at 19:36
  • 2 anything is possible. Possible but not pretty. If you really want the field right there, you could create a custom field and position it there with JS, then use JS to save the value on blur. – RiddleMeThis Commented Feb 7, 2019 at 19:48
  • 1 @helgatheviking I agree that it’s not good UI if it’s somewhere at the bottom. But there is no nice way to put custom inputs after the title. As I mentioned before - “Gutenberg solution” would be to create a custom block, make it appear as first, render as empty and store data in custom field. – Krzysiek Dróżdż Commented Feb 8, 2019 at 6:28
  • 1 @am_It doesn't appear in the post content. No one said anything about it not appearing on the front end. – Jacob Peattie Commented Feb 8, 2019 at 8:47
  • 1 Can you maybe replace the title block with a custom one that has two input fields? – fuxia Commented Feb 8, 2019 at 19:17
 |  Show 10 more comments

1 Answer 1

Reset to default 1

Initially Gutenberg had plans to implement subheading, See this ticket but later they deprecated it. As of now, there's no hook to do it other than building a custom block. May be in near future you'll find something useful.

I hope this helps

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1748918797a314813.html

最新回复(0)