$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>javascript - Adding a text element in between title and blocks container|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

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

matteradmin8PV0评论

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

Post a comment

comment list (0)

  1. No comments so far