gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

Meta Boxes: Support the "after_title" context

Open thatdevgirl opened this issue 8 years ago • 23 comments

Issue Overview

I would love to see support for the after_title meta box context in Gutenberg. This context is currently supported in the classic editor, placing meta boxes after the page title (but before the editor).

Right now, when I create a meta box using the after_title context (or any context that is not supported in Gutenberg; i.e.normal or advanced), the meta box does not appear on the page at all. I am using the Gutenberg plugin and creating meta boxes with the Meta Box plugin. I understand from the Meta Box plugin author is that any other contexts are unsupported by Gutenberg; he recommended that we not use contexts at all.

I am advocating for supporting the after_title context because there can be cases where the content in a meta box is meant to appear before the content in the post editor on the front-end. Having the meta box appear above the post editor on the edit screen is ideal from a UX perspective, because it will allow content editors to edit the page in order. If all of the meta boxes appear below the post editor in the edit screen, a content editor may be confused as to where to find a particular meta box if they are used to seeing its content above the main body of the page (on the front-end).

Steps to Reproduce

  1. Create a meta box with the after_title context. (Again, I was using the Meta Box plugin to create meta boxes, but I suspect the outcome will be similar regardless of how the meta box is created.)
  2. View the page edit screen with the Gutenberg editor.

Expected Behavior

I should see the meta box below the page title and above the post editor.

Current Behavior

The meta box does not appear at all.

thatdevgirl avatar Mar 27 '18 16:03 thatdevgirl

I looked at this a bit and it looks like after_title is not a supported meta box location in WordPress.

Plugins hack the post editor to add it.

youknowriad avatar Mar 29 '18 10:03 youknowriad

Having inserted fields myself into that area, it is done using the edit_form_after_title action hook which fires between the title and the editor.

It doesn't specifically output meta boxes but can be used to output ANY content into this area.

I'm not sure how that hook could be used within the framework of the Gutenberg editor?

benhuson avatar Mar 29 '18 13:03 benhuson

We may consider supporting this hook yes :) edit_form_after_title. Thoughts @mtias @aduth

youknowriad avatar Mar 29 '18 14:03 youknowriad

It's something of a design consideration as well.

I think it could be reasonable to support, but more for backwards-compatibility so as not to break existing workflows, and maybe not as a first-class support; i.e. not necessarily located under title, but grouped with meta boxes.

aduth avatar Mar 30 '18 17:03 aduth

@thatdevgirl Just to clarify, did you mean edit_form_after_title in your original report? Or is there some other after_title aspect we should be aware of?

danielbachhuber avatar Jun 04 '18 13:06 danielbachhuber

@danielbachhuber I did mean edit_form_after_title. I've been using the Meta Box plugin and they call that context after_title (I guess they're simplifying the name for their users?).

thatdevgirl avatar Jun 05 '18 19:06 thatdevgirl

@thatdevgirl Makes sense, thanks! Moving to the Back Compat milestone to evaluate there.

danielbachhuber avatar Jun 05 '18 20:06 danielbachhuber

Hi! I have a similar issue, any update?

bianqui149 avatar Aug 07 '18 12:08 bianqui149

@bianqui149 Not yet. If we have an update, we will post it here.

Soean avatar Aug 07 '18 12:08 Soean

I have a bunch of client sites that rely on this hook to render meta boxes. +1 for supporting in some way.

eriktdesign avatar Aug 14 '18 20:08 eriktdesign

Definitely had need of it also, and was disappointed to find it (like so many other previously-functional actions/filters) no longer works.

krisgale-zz avatar Aug 15 '18 19:08 krisgale-zz

Because of this removal the GDPR privacy policy help:-

"Need help putting together your new Privacy Policy page? Check out our guide (opens in a new tab) for recommendations on what content to include, along with policies suggested by your plugins and theme."

which appears before the "editor" (so the ideal place) with Classic just doesn't appear at all with Gutenberg active. Since it breaks Wordpress itself hopefully an equivalent will be forthcoming.

mgcd avatar Aug 24 '18 09:08 mgcd

@matias Can we get a decision on this issue (either to support the after_title action or not)? Or, if we can't make a decision yet, can we get clarity on the decision-making criteria so we can help track down the information we need to make a decision?

danielbachhuber avatar Oct 10 '18 14:10 danielbachhuber

Any news on this?

elliotcondon avatar Nov 02 '18 07:11 elliotcondon

+1 on this please - it would be VERY useful to have a after_title() hook available, we sometimes insert our own controls/info/bits up there for header options etc in our bespoke theme builds in the editor!

If this is going to get supported (which is should IMHO - many bespoke theme developers need this!!) why not add an additional before_editor_title() hook too ;)

Also worth noting to test support that hook still triggers if remove_post_type_support( $post_type, 'title' ); is deployed.

Jonnyauk avatar Nov 15 '18 17:11 Jonnyauk

This is a tricky area because we don't want to set expectations for accessing edit_form_after_title that would be immediately invalidated as soon as the post tile becomes a block (and part of the editor flow) in the next phase. At that point all the canvas will have the expectation of visually matching the front.

mtias avatar Nov 20 '18 22:11 mtias

Because of this removal the GDPR privacy policy help which appears before the "editor" with Classic just doesn't appear at all with Gutenberg active.

@mgcd To follow up on this specific instance, this has now been resolved in #11999. The fix has also been committed to WordPress Core, and there is a PR on the Classic Editor plugin to maintain the current 4.9.x behavior when that plugin is active.

The notice now appears correctly as of Gutenberg 4.5, and will in Core as of the next Beta/RC release.

desrosj avatar Nov 21 '18 16:11 desrosj

Hi, I have a similar issue, any news?

musus avatar Aug 20 '19 07:08 musus

I agree that having the ability to target this area makes sense, as sometimes I need to set up client instruction, and it's best to have it front and center.

That said, could this be supported ONLY above the title, rather than after it? I get the point @mtias makes about having the title look like it's part of the flow with the rest of the content.

eyesofjeremy avatar Sep 26 '19 03:09 eyesofjeremy

I like the idea of supporting this only above the title. So, maybe it should really be a before_title context? (Because, semantics.)

The use case for having a meta box in the after_title context that I usually deal with does not display the title at all on the front-end because it tends to be a landing page where content in the after_title is a full-width hero block in the designs and the title is not actually displayed on the page. But, if a title were to be displayed on the page, I would want it to be after that hero block anyway. (Disclaimer: I'm definitely not a designer.)

thatdevgirl avatar Sep 26 '19 16:09 thatdevgirl