| 1 |
<?php |
| 2 |
|
| 3 |
namespace Elementor\Modules\GlobalClasses; |
| 4 |
|
| 5 |
if ( ! defined( 'ABSPATH' ) ) { |
| 6 |
exit; // Exit if accessed directly. |
| 7 |
} |
| 8 |
|
| 9 |
class Global_Class_Post_Type { |
| 10 |
const CPT = 'e_global_class'; |
| 11 |
|
| 12 |
public function register() { |
| 13 |
add_action( 'init', [ $this, 'register_post_type' ] ); |
| 14 |
} |
| 15 |
|
| 16 |
public function register_post_type() { |
| 17 |
register_post_type( self::CPT, [ |
| 18 |
'label' => esc_html__( 'Global Class', 'elementor' ), |
| 19 |
'labels' => [ |
| 20 |
'name' => esc_html__( 'Global Classes', 'elementor' ), |
| 21 |
'singular_name' => esc_html__( 'Global Class', 'elementor' ), |
| 22 |
], |
| 23 |
'public' => false, |
| 24 |
'supports' => [ 'title' ], |
| 25 |
] ); |
| 26 |
} |
| 27 |
|
| 28 |
public static function ensure_registered(): void { |
| 29 |
if ( ! post_type_exists( self::CPT ) ) { |
| 30 |
( new self() )->register_post_type(); |
| 31 |
} |
| 32 |
} |
| 33 |
} |
| 34 |
|