class-common.php
1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
/**
* Adds a custom post type.
*
* @package um_ext\um_account_tabs\core
*/
namespace um_ext\um_account_tabs\core;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Class Common.
*
* @package um_ext\um_account_tabs\core
*/
class Common {
/**
* Common constructor.
*/
public function __construct() {
add_action( 'init', array( $this, 'register_post_type' ), 2 );
}
/**
* Register custom post type.
*/
public function register_post_type() {
$labels = array(
'name' => _x( 'Account tabs', 'Post Type General Name', 'um-account-tabs' ),
'singular_name' => _x( 'Account tab', 'Post Type Singular Name', 'um-account-tabs' ),
'menu_name' => __( 'Account Tabs', 'um-account-tabs' ),
'all_items' => __( 'All Tabs', 'um-account-tabs' ),
'add_new_item' => __( 'Add New Tab', 'um-account-tabs' ),
'add_new' => __( 'Add New', 'um-account-tabs' ),
'new_item' => __( 'New Tab', 'um-account-tabs' ),
'edit_item' => __( 'Edit Tab', 'um-account-tabs' ),
'update_item' => __( 'Update Tab', 'um-account-tabs' ),
'view_item' => __( 'View Tab', 'um-account-tabs' ),
'view_items' => __( 'View Tabs', 'um-account-tabs' ),
);
$args = array(
'label' => __( 'Account Tabs', 'um-account-tabs' ),
'labels' => $labels,
'hierarchical' => false,
'public' => false,
'show_ui' => true,
'show_in_menu' => false,
'show_in_admin_bar' => false,
'show_in_nav_menus' => false,
'can_export' => false,
'has_archive' => false,
'exclude_from_search' => true,
'capability_type' => 'page',
'supports' => array( 'title', 'editor' ),
);
register_post_type( 'um_account_tabs', $args );
}
}