api
3 weeks ago
assets
3 weeks ago
controls
3 weeks ago
fonts
5 years ago
views
4 years ago
cpt.php
4 years ago
init.php
2 years ago
live-action.php
4 months ago
widget-file.php
4 years ago
cpt.php
54 lines
| 1 | <?php |
| 2 | namespace ElementsKit_Lite\Modules\Widget_Builder; |
| 3 | |
| 4 | defined( 'ABSPATH' ) || exit; |
| 5 | |
| 6 | class Cpt { |
| 7 | |
| 8 | public function __construct() { |
| 9 | $this->post_type(); |
| 10 | |
| 11 | add_action( 'admin_menu', array( $this, 'cpt_menu' ) ); |
| 12 | } |
| 13 | |
| 14 | public function post_type() { |
| 15 | |
| 16 | $labels = array( |
| 17 | 'name' => esc_html__( 'Widgets', 'elementskit-lite' ), |
| 18 | 'singular_name' => esc_html__( 'Widget', 'elementskit-lite' ), |
| 19 | 'menu_name' => esc_html__( 'Widget Builder', 'elementskit-lite' ), |
| 20 | 'name_admin_bar' => esc_html__( 'Widgets', 'elementskit-lite' ), |
| 21 | 'add_new' => esc_html__( 'Add New', 'elementskit-lite' ), |
| 22 | 'add_new_item' => esc_html__( 'Add New Widget', 'elementskit-lite' ), |
| 23 | 'new_item' => esc_html__( 'New Widget', 'elementskit-lite' ), |
| 24 | 'edit_item' => esc_html__( 'Edit Widget', 'elementskit-lite' ), |
| 25 | 'view_item' => esc_html__( 'View Widget', 'elementskit-lite' ), |
| 26 | 'all_items' => esc_html__( 'All Widgets', 'elementskit-lite' ), |
| 27 | 'search_items' => esc_html__( 'Search Widgets', 'elementskit-lite' ), |
| 28 | 'parent_item_colon' => esc_html__( 'Parent Widgets:', 'elementskit-lite' ), |
| 29 | 'not_found' => esc_html__( 'No Widgets found.', 'elementskit-lite' ), |
| 30 | 'not_found_in_trash' => esc_html__( 'No Widgets found in Trash.', 'elementskit-lite' ), |
| 31 | ); |
| 32 | |
| 33 | $args = array( |
| 34 | 'labels' => $labels, |
| 35 | 'public' => true, |
| 36 | 'rewrite' => false, |
| 37 | 'show_ui' => true, |
| 38 | 'show_in_menu' => false, |
| 39 | 'show_in_nav_menus' => false, |
| 40 | 'exclude_from_search' => true, |
| 41 | 'capability_type' => 'page', |
| 42 | 'hierarchical' => false, |
| 43 | 'supports' => array( 'title', 'elementor' ), |
| 44 | ); |
| 45 | |
| 46 | register_post_type( 'elementskit_widget', $args ); |
| 47 | } |
| 48 | |
| 49 | public function cpt_menu() { |
| 50 | $link_our_new_cpt = 'edit.php?post_type=elementskit_widget'; |
| 51 | add_submenu_page( 'elementskit', esc_html__( 'Widget Builder', 'elementskit-lite' ), esc_html__( 'Widget Builder', 'elementskit-lite' ), 'manage_options', $link_our_new_cpt ); |
| 52 | } |
| 53 | } |
| 54 |