For a project, I'm trying to figure out the best way to implement a checkbox, related to a post type.

What I'm trying to to:

On the final website, there should be a dropdown-button, with upcoming events inside. I was thinking of creating a custom post type "events", which will then of course be rendered in that dropdown div.

Now on the post type "page" (or maybe some others as well), in the editing screen, I'd like to have a checkbox to enable "show recent events on this page".

1. My first Idea, was to extend the document panel on the right (wordpress 5 - Gutenberg) with an additional section, similar to the discussion section:

enter image description here

But the only way to change anything inside the document panel I found was creating a hook to either editor.PostFeaturedImage or editor.PostTaxonomyType, which will be inside a section and not adding a new one.

2. So my second Idea was an approach of using Gutenberg blocks. I was thinking of creating a Meta Block field, like I found in the documentation of Gutenberg but the problem with that is, that that the user would have to add the block himself first, when I would rather have it there by default and if possible not removable.

So my final question is, which option would be the better one to go with, or is there an even better way to do it and how could I fix the described problems above?

I appreciate all the help!

Your Answer

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

Browse other questions tagged or ask your own question.