PluginProbe
Easy Elements for Elementor – Addons & Website Templates / 1.4.8
Easy Elements for Elementor – Addons & Website Templates v1.4.8
1.5.3 1.5.2 1.5.1 1.5.0 1.4.9 1.4.6 1.4.7 1.4.8 1.4.5 1.4.4 1.4.3 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 All 47 releases
easy-elements / includes / PostType / OffcanvasPostType.php

OffcanvasPostType.php in Easy Elements for Elementor – Addons & Website Templates 1.4.8, at includes/PostType/OffcanvasPostType.php

75 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Easyel\EasyElements\PostType;
3 defined( 'ABSPATH' ) || exit;
4
5
6 class OffcanvasPostType {
7
8 protected static $instance = null;
9
10 private string $type = 'easy-offcanvas';
11 private string $slug = 'easy-offcanvas';
12 private string $name = 'Off Canvas';
13 private string $singular_name = 'Off Canvas';
14 private string $icon = 'dashicons-menu';
15
16 public function __construct() {
17 add_action( 'init', [ $this, 'register' ] );
18 add_action( 'elementor/init', [ $this, 'enable_elementor_support' ] );
19 }
20
21 /**
22 * Get instance
23 */
24 public static function get_instance() {
25 if ( null === self::$instance ) {
26 self::$instance = new self();
27 }
28 return self::$instance;
29 }
30
31 /**
32 * Register Custom Post Type
33 */
34 public function register(): void {
35 register_post_type( $this->type, [
36 'labels' => [
37 'name' => __( 'Off Canvas', 'easy-elements' ),
38 'singular_name' => __( 'Off Canvas', 'easy-elements' ),
39 'add_new' => __( 'Add New', 'easy-elements' ),
40 'add_new_item' => __( 'Add New Off Canvas', 'easy-elements' ),
41 'edit_item' => __( 'Edit Off Canvas', 'easy-elements' ),
42 'new_item' => __( 'New Off Canvas', 'easy-elements' ),
43 'all_items' => __( 'All Off Canvas', 'easy-elements' ),
44 'view_item' => __( 'View Off Canvas', 'easy-elements' ),
45 'search_items' => __( 'Search Off Canvas', 'easy-elements' ),
46 'not_found' => __( 'No off canvas found', 'easy-elements' ),
47 'not_found_in_trash' => __( 'No off canvas found in Trash', 'easy-elements' ),
48 'menu_name' => __( 'Off Canvas', 'easy-elements' ),
49 ],
50 'public' => true,
51 'show_ui' => true,
52 'show_in_menu' => false,
53 'query_var' => true,
54 'rewrite' => [ 'slug' => $this->slug ],
55 'capability_type' => 'post',
56 'has_archive' => false,
57 'hierarchical' => false,
58 'menu_position' => 21,
59 'menu_icon' => $this->icon,
60 'supports' => [ 'title', 'editor' ],
61 'exclude_from_search'=> true,
62 'publicly_queryable' => true,
63 'show_in_rest' => true,
64 ] );
65
66 }
67
68 /**
69 * Enable Elementor editor support
70 */
71 public function enable_elementor_support(): void {
72 add_post_type_support( $this->type, 'elementor' );
73 }
74 }
75