diff --git a/modules/sportspress-gutenberg.php b/modules/sportspress-gutenberg.php new file mode 100644 index 00000000..75ef5452 --- /dev/null +++ b/modules/sportspress-gutenberg.php @@ -0,0 +1,58 @@ +define_constants(); + + add_filter( 'gutenberg_can_edit_post_type', array( $this, 'can_edit_post_type' ), 10, 2 ); + } + + /** + * Define constants. + */ + private function define_constants() { + if ( !defined( 'SP_GUTENBERG_VERSION' ) ) + define( 'SP_GUTENBERG_VERSION', '2.6.8' ); + + if ( !defined( 'SP_GUTENBERG_URL' ) ) + define( 'SP_GUTENBERG_URL', plugin_dir_url( __FILE__ ) ); + + if ( !defined( 'SP_GUTENBERG_DIR' ) ) + define( 'SP_GUTENBERG_DIR', plugin_dir_path( __FILE__ ) ); + } + + /** + * Modify Gutenberg behavior for custom post types. + */ + function can_edit_post_type( $enabled, $post_type ) { + return is_sp_post_type( $post_type ) ? false : $enabled; + } +} + +endif; + +new SportsPress_Gutenberg();