PluginProbe
Easy Elements for Elementor – Addons & Website Templates / 1.0.8
Easy Elements for Elementor – Addons & Website Templates v1.0.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 / inc / canvas-content.php

canvas-content.php in Easy Elements for Elementor – Addons & Website Templates 1.0.8, at inc/canvas-content.php

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