2

I have not liked the way that the post/page title in Wordpress 6 / Gutenberg is contained directly in the block editor. I have found many ways to remove it with filters and / or restyle it but ultimately what I seek is for the title to be included in the post-status panel of the sidebar instead. Certain posts/pages can still contain a post-title block but having this compulsory rendering in the editor is a distraction to more complex layouts.

It seems I am not alone in this view and there was this beautiful concept but nothing appears to have come of it. https://github.com/WordPress/gutenberg/pull/42352

Whilst some appear to share my irritation in the GitHub request I cannot see a plugin or pull-request to address us picky people available at this moment in time. So I have attempted to do it myself but node.js does not come easily and there is a dearth of documentation.

Using @wordpress/scripts I was able to create a custom panel in the side bar however I am struggling to find the relevant documentation to use it modify / update the post title. All I have so far is a rendering of the panel.

(function (wp) {
  const { TextControl, PanelRow } = wp.components;
  const { registerPlugin } = wp.plugins;
  const { PluginDocumentSettingPanel } = wp.editPost;

  registerPlugin("editor-setup-panel", {
    render: function () {
      return (
        <PluginDocumentSettingPanel
          name="setup-panel"
          title="Setup"
        >
          <TextControl label={"Title"} value={""} onChange={(value) => false} />
        </PluginDocumentSettingPanel>
      );
    },
    icon: false,
  });
})(window.wp);

This does not actually get the title as I cannot see how to do that and it therefore certainly doesn't update anything hence why onChanged is also not set.

Ideally it should also appear above the status panel but I can't see how to change it's position either nor have it open by default.

Is there any documentation on this anywhere. enter image description here

EDIT (solution 1)

The basic plugin that adds title to sidebar is complete. It also removes the generated title from the editor (if you want it back then use a Post Title block - as it should have always been).:

enter image description here

Edit (pending solution 2)

Implementing the full sample seen here has proved more challenging. I did recreate it entirely in a separate panel using PluginDocumentSettingPanel but certain attributed like URL are not exported from @wordpress/edit-post at all. Even copying the code listed on the Gutenberg repository will not render two of the components needed to fully recreate it with additional attributes.

Therefore, don't recreate the panel. Use the slot provided in PluginPostStatusInfo and add the featured image, title and excerpt here. Yes it's not in the right position however, the slot is not relatively positioned which means we can reposition it. WorkInProgress but see the red section in the image.enter image description here

I will release these all as plugins in due course. Having reviewed the document guide it's just not very interesting to do it now as I'm in the middle of a project. However, I know that (contrary to the abundance of interest in the stackExchange Wordpress community over gutenberg, the title sidebar feature is actually in high demand. If someone would like the code and go through the plugin formalities they are welcome to it.

EDIT 3 Full Solution

And there it is, fully completed and fully functional. You can see both versions in this screenshot. Now to work out how to submit plugins (never done it before) to wp and I'll post them as the answer once they are available.

enter image description here

2
  • The answer is yes you can if you build the relevant react components. If you're like me then you'll spend the whole day styling them too. I'll post answer tomorrow. To create the aesthetic of the PR can also be done but I would not advise it. It's a lot of react and us fussy ui people should accept Wordpress is a bloated, all for one platform that has to serve backwards compatibility and be sufficiently complicated to maintain a marketplace for developers. If we redesign it we might as well build a system of our own - don't do that either, it takes ages and you'll never get the bugs sorted.
    – Walrus
    Oct 16 at 17:30
  • All is working but I'll release a plugin instead (on the house). Explaining this much react is really painful and I don't think anyone who wants this will get it. It's will give the panel just under summary called "Title" (translations included) and perform the functionality as it is locally for me. I'll also be working on replicating the proposal here at the following link. I really think this is how it should look. github.com/WordPress/gutenberg/issues/39082
    – Walrus
    Oct 17 at 15:19

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.