Learn in this tutorial how to enable extra options in the Genesis sidebar inside the block editor for a Custom Post Type (CPT) using code.
The Genesis 3.1 release introduced a new Genesis Framework specific sidebar to the WordPress block editor.
In it you can control:
- Hide/show breadcrumbs.
- Hide/show titles.
- Hide/show featured images.
- Page layout.
- Hide/show footer widgets.
- Add custom CSS classes.
By default, these options are available for pages or entries.
But in this tutorial you will see how to enable them in the Custom Post Type of your choice.
Shall we go there?
Snippet to enable more options in the Genesis sidebar inside the editor for a CPT
Two situations can occur:
- That the plugin was created by you.
- Or that it is a plugin from the WordPress repository.
Here is the solution for both possibilities.
1. Custom Post Type
If you used the tutorial to create a CPT using code you don’t need to do anything because that tutorial is already updated and ready for the CPT to display the new editor.
2. CPT plugin created by another developer
If the plugin was developed by a third party, add this snippet in functions.php or to your functionality plugin:
With this snippet you make the new Genesis sidebar in the editor available for the CPT “Portfolio” (i.e. with the slug “portfolio”).
Of course, I invite you to change it for the one that interests you the most.
Do you want all the new Genesis options to appear in your sidebar inside the block editor for one of your CPTs?
Now you know how to selectively enable it through code.
If you have any question, please leave it in the comments. And if you want to give me a suggestion for future snippets, please send it through the contact form.
Benefits of being a subscriber. 🙂