| 1 |
<?php |
| 2 |
/** |
| 3 |
* Templates |
| 4 |
* |
| 5 |
* @package ghostkit |
| 6 |
*/ |
| 7 |
|
| 8 |
/** |
| 9 |
* GhostKit_Templates |
| 10 |
*/ |
| 11 |
class GhostKit_Templates { |
| 12 |
/** |
| 13 |
* GhostKit_Templates constructor. |
| 14 |
*/ |
| 15 |
public function __construct() { |
| 16 |
// Register custom post type. |
| 17 |
add_action( 'init', array( $this, 'add_custom_post_type' ) ); |
| 18 |
} |
| 19 |
|
| 20 |
/** |
| 21 |
* Register custom post type. |
| 22 |
*/ |
| 23 |
public function add_custom_post_type() { |
| 24 |
register_post_type( |
| 25 |
'ghostkit_template', |
| 26 |
array( |
| 27 |
'labels' => array( |
| 28 |
'name' => _x( 'Templates', 'Post Type General Name', 'ghostkit' ), |
| 29 |
'singular_name' => _x( 'Template', 'Post Type Singular Name', 'ghostkit' ), |
| 30 |
'menu_name' => __( 'Templates', 'ghostkit' ), |
| 31 |
'parent_item_colon' => __( 'Parent Template', 'ghostkit' ), |
| 32 |
'all_items' => __( 'Templates', 'ghostkit' ), |
| 33 |
'view_item' => __( 'View Template', 'ghostkit' ), |
| 34 |
'add_new_item' => __( 'Add New Template', 'ghostkit' ), |
| 35 |
'add_new' => __( 'Add New', 'ghostkit' ), |
| 36 |
'edit_item' => __( 'Edit Template', 'ghostkit' ), |
| 37 |
'update_item' => __( 'Update Template', 'ghostkit' ), |
| 38 |
'search_items' => __( 'Search Template', 'ghostkit' ), |
| 39 |
'not_found' => __( 'Not Found', 'ghostkit' ), |
| 40 |
'not_found_in_trash' => __( 'Not found in Trash', 'ghostkit' ), |
| 41 |
), |
| 42 |
'public' => false, // true? |
| 43 |
'publicly_queryable' => false, // true? |
| 44 |
'has_archive' => false, |
| 45 |
'show_ui' => true, |
| 46 |
'exclude_from_search' => true, |
| 47 |
'show_in_nav_menus' => false, |
| 48 |
'rewrite' => false, |
| 49 |
// phpcs:ignore |
| 50 |
'menu_icon' => 'data:image/svg+xml;base64,' . base64_encode( file_get_contents( ghostkit()->plugin_path . 'assets/images/admin-icon-templates.svg' ) ), |
| 51 |
'menu_position' => 57, |
| 52 |
'hierarchical' => false, |
| 53 |
'show_in_menu' => true, |
| 54 |
'show_in_admin_bar' => true, |
| 55 |
'show_in_rest' => true, |
| 56 |
'taxonomies' => array( |
| 57 |
'ghostkit_template_category', |
| 58 |
), |
| 59 |
'capability_type' => 'post', |
| 60 |
'supports' => array( |
| 61 |
'title', |
| 62 |
'editor', |
| 63 |
'thumbnail', |
| 64 |
), |
| 65 |
) |
| 66 |
); |
| 67 |
|
| 68 |
register_taxonomy( |
| 69 |
'ghostkit_template_category', |
| 70 |
'ghostkit_template', |
| 71 |
array( |
| 72 |
'label' => esc_html__( 'Categories', 'ghostkit' ), |
| 73 |
'labels' => array( |
| 74 |
'menu_name' => esc_html__( 'Categories', 'ghostkit' ), |
| 75 |
), |
| 76 |
'rewrite' => false, |
| 77 |
'hierarchical' => false, |
| 78 |
'publicly_queryable' => false, |
| 79 |
'show_in_nav_menus' => false, |
| 80 |
'show_in_rest' => true, |
| 81 |
'show_admin_column' => true, |
| 82 |
) |
| 83 |
); |
| 84 |
} |
| 85 |
} |
| 86 |
|
| 87 |
new GhostKit_Templates(); |
| 88 |
|