| 1 |
<?php |
| 2 |
/** |
| 3 |
* Anzu Page Templates Library |
| 4 |
* |
| 5 |
*/ |
| 6 |
|
| 7 |
// Exit if accessed directly. |
| 8 |
defined( 'ABSPATH' ) || exit; |
| 9 |
|
| 10 |
// Register Custom Post Type |
| 11 |
function anzu_templates() { |
| 12 |
|
| 13 |
$labels = array( |
| 14 |
'name' => _x( 'Templates', 'Post Type General Name', 'borderless' ), |
| 15 |
'singular_name' => _x( 'Template', 'Post Type Singular Name', 'borderless' ), |
| 16 |
'menu_name' => __( 'Templates', 'borderless' ), |
| 17 |
'name_admin_bar' => __( 'Template', 'borderless' ), |
| 18 |
'archives' => __( 'Item Archives', 'borderless' ), |
| 19 |
'attributes' => __( 'Item Attributes', 'borderless' ), |
| 20 |
'parent_item_colon' => __( 'Parent Item:', 'borderless' ), |
| 21 |
'all_items' => __( 'All Items', 'borderless' ), |
| 22 |
'add_new_item' => __( 'Add New Item', 'borderless' ), |
| 23 |
'add_new' => __( 'Add New', 'borderless' ), |
| 24 |
'new_item' => __( 'New Item', 'borderless' ), |
| 25 |
'edit_item' => __( 'Edit Item', 'borderless' ), |
| 26 |
'update_item' => __( 'Update Item', 'borderless' ), |
| 27 |
'view_item' => __( 'View Item', 'borderless' ), |
| 28 |
'view_items' => __( 'View Items', 'borderless' ), |
| 29 |
'search_items' => __( 'Search Item', 'borderless' ), |
| 30 |
'not_found' => __( 'Not found', 'borderless' ), |
| 31 |
'not_found_in_trash' => __( 'Not found in Trash', 'borderless' ), |
| 32 |
'featured_image' => __( 'Featured Image', 'borderless' ), |
| 33 |
'set_featured_image' => __( 'Set featured image', 'borderless' ), |
| 34 |
'remove_featured_image' => __( 'Remove featured image', 'borderless' ), |
| 35 |
'use_featured_image' => __( 'Use as featured image', 'borderless' ), |
| 36 |
'insert_into_item' => __( 'Insert into item', 'borderless' ), |
| 37 |
'uploaded_to_this_item' => __( 'Uploaded to this item', 'borderless' ), |
| 38 |
'items_list' => __( 'Items list', 'borderless' ), |
| 39 |
'items_list_navigation' => __( 'Items list navigation', 'borderless' ), |
| 40 |
'filter_items_list' => __( 'Filter items list', 'borderless' ), |
| 41 |
); |
| 42 |
$args = array( |
| 43 |
'label' => __( 'Template', 'borderless' ), |
| 44 |
'description' => __( 'Anzu Templates Library', 'borderless' ), |
| 45 |
'labels' => $labels, |
| 46 |
'show_in_rest' => true, |
| 47 |
'supports' => array( 'title', 'editor', 'revisions' ), |
| 48 |
'hierarchical' => false, |
| 49 |
'public' => true, |
| 50 |
'show_ui' => true, |
| 51 |
'show_in_menu' => false, |
| 52 |
'menu_position' => 5, |
| 53 |
'show_in_admin_bar' => false, |
| 54 |
'show_in_nav_menus' => false, |
| 55 |
'can_export' => true, |
| 56 |
'has_archive' => true, |
| 57 |
'exclude_from_search' => false, |
| 58 |
'publicly_queryable' => true, |
| 59 |
'capability_type' => 'page', |
| 60 |
); |
| 61 |
register_post_type( 'anzu_templates', $args ); |
| 62 |
|
| 63 |
} |
| 64 |
add_action( 'init', 'anzu_templates', 0 ); |
| 65 |
|
| 66 |
|
| 67 |
function anzu_templates_menu() { |
| 68 |
add_submenu_page( |
| 69 |
'anzu', |
| 70 |
__( 'Templates', 'borderless' ), |
| 71 |
__( 'Templates', 'borderless' ), |
| 72 |
'manage_options', |
| 73 |
'edit.php?post_type=anzu_templates', |
| 74 |
'', |
| 75 |
1 |
| 76 |
); |
| 77 |
} |
| 78 |
|
| 79 |
add_action('admin_menu', 'anzu_templates_menu'); |