PluginProbe
YayMail – WooCommerce Email Customizer / 4.4.2
YayMail – WooCommerce Email Customizer v4.4.2
4.4.4 4.4.3 4.4.2 4.4.1 trunk 1.9.6 2.1.4 2.1.5 3.2.2 3.2.6 3.2.7.1 3.2.8.1 3.2.9 3.3 3.3.1 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9 3.4 3.4.1 3.4.2 3.4.3 All 55 releases
yaymail / src / PostTypes / TemplatePostType.php

TemplatePostType.php in YayMail – WooCommerce Email Customizer 4.4.2, at src/PostTypes/TemplatePostType.php

63 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace YayMail\PostTypes;
4
5 use YayMail\Utils\SingletonTrait;
6
7 /**
8 * Custom Post Type
9 *
10 * @method static TemplatePostType get_instance()
11 */
12 class TemplatePostType {
13 use SingletonTrait;
14
15 public const POST_TYPE = 'yaymail_template';
16
17 /**
18 * Constructor
19 */
20 protected function __construct() {
21 $this->init_hooks();
22 }
23
24 /**
25 * Initialize hooks when class init
26 */
27 protected function init_hooks() {
28 // Register Custom Post Type for YayMail Template
29 add_action( 'init', [ $this, 'register_template_post_type' ], 20 );
30 }
31
32 public function register_template_post_type() {
33 $labels = [
34 'name' => __( 'Email Template', 'yaymail' ),
35 'singular_name' => __( 'Email Template', 'yaymail' ),
36 'add_new' => __( 'Add New Email Template', 'yaymail' ),
37 'add_new_item' => __( 'Add a new Email Template', 'yaymail' ),
38 'edit_item' => __( 'Edit Email Template', 'yaymail' ),
39 'new_item' => __( 'New Email Template', 'yaymail' ),
40 'view_item' => __( 'View Email Template', 'yaymail' ),
41 'search_items' => __( 'Search Email Template', 'yaymail' ),
42 'not_found' => __( 'No Email Template found', 'yaymail' ),
43 'not_found_in_trash' => __( 'No Email Template currently trashed', 'yaymail' ),
44 'parent_item_colon' => '',
45 ];
46 $args = [
47 'labels' => $labels,
48 'public' => false,
49 'publicly_queryable' => false,
50 'show_ui' => false,
51 'query_var' => true,
52 'rewrite' => true,
53 'capability_type' => self::POST_TYPE,
54 'capabilities' => [],
55 'hierarchical' => false,
56 'menu_position' => null,
57 'exclude_from_search' => true,
58 'supports' => [ 'title', 'author', 'thumbnail', 'revisions' ],
59 ];
60 register_post_type( self::POST_TYPE, $args );
61 }
62 }
63