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

Text input for a Subtitle in the Gutenberg editor. Appears after Title text area and before Blocks container.

  • 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ż Feb 7 at 19:36
  • 1
    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 Feb 7 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ż Feb 8 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 Feb 8 at 8:47
  • 1
    Can you maybe replace the title block with a custom one that has two input fields? – fuxia Feb 8 at 19:17
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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