Published on 09/23/2020
Published by amit
How To Enable Gutenberg Block in Awesome App Pages
We recently needed to enable Gutenberg blocks in awesome app pages here is how you can enable Gutenberg block for Awesome app pages.
In the example below, we are enabling the block editor for p_contentcentral post type, which is used by an Awesome App.
In the site-specific.php file add the following code
1 2 3 4 5 6 |
function dl_remove_awesome_app_pages($app_post_types) { $key = array_search('p_contentcentral', $app_post_types); unset($app_post_types[$key]); return $app_post_types; } add_filter('monoframe-awesome-post-types', 'dl_remove_awesome_app_pages'); |
This code is used to remove the p_contentcentral from the awesome post type collection so as to hide the code editor that shows in Awesome App pages.
Finally, you will have to register the p_contentcentral using Custom post type UI plugin with the following options
- Capability Type set as page,
- Hierarchical set as True,
- ‘Show in REST API‘ setting as True,
- Show in Menu set as False,
- Rewrite set as True,
- Custom Rewrite Slug set as the slug of the App whose page we are overwriting,
- With Front set as False.
- Editor selected in Supports section.
Once this is done, you can start using Gutenberg Block Editor on awesome app pages.