Таксономии
if (!function_exists('register_taxonomy_cpt_list')) {
// Register Custom Taxonomy
function register_taxonomy_cpt_list()
{
$labels = array(
'name' => _x('Категории запросов', 'Taxonomy General Name', 'sp-basic'),
'singular_name' => _x('Категория запроса', 'Taxonomy Singular Name', 'sp-basic'),
'menu_name' => __('Категории запросов', 'sp-basic'),
'all_items' => __('All Items', 'sp-basic'),
'parent_item' => __('Parent Item', 'sp-basic'),
'parent_item_colon' => __('Parent Item:', 'sp-basic'),
'new_item_name' => __('New Item Name', 'sp-basic'),
'add_new_item' => __('Add New Item', 'sp-basic'),
'edit_item' => __('Edit Item', 'sp-basic'),
'update_item' => __('Update Item', 'sp-basic'),
'view_item' => __('View Item', 'sp-basic'),
'separate_items_with_commas' => __('Separate items with commas', 'sp-basic'),
'add_or_remove_items' => __('Add or remove items', 'sp-basic'),
'choose_from_most_used' => __('Choose from the most used', 'sp-basic'),
'popular_items' => __('Popular Items', 'sp-basic'),
'search_items' => __('Search Items', 'sp-basic'),
'not_found' => __('Not Found', 'sp-basic'),
'no_terms' => __('No items', 'sp-basic'),
'items_list' => __('Items list', 'sp-basic'),
'items_list_navigation' => __('Items list navigation', 'sp-basic'),
);
$args = array(
'labels' => $labels,
'hierarchical' => true,
'public' => true,
'show_ui' => true,
'show_admin_column' => true,
'show_in_nav_menus' => true,
'show_tagcloud' => true,
'show_in_rest' => true,
);
register_taxonomy('catalog', array('zapros'), $args);
}
add_action('init', 'register_taxonomy_cpt_list', 0);
}
//=============== //
Тип записи
if (!function_exists('register_cpt_zapros')) {
// Register Custom Post Type
function register_cpt_zapros()
{
$labels = array(
'name' => _x('Запросы', 'Post Type General Name', 'sp-basic'),
'singular_name' => _x('Запрос', 'Post Type Singular Name', 'sp-basic'),
'menu_name' => __('Запросы', 'sp-basic'),
'name_admin_bar' => __('Запросы клиентов', 'sp-basic'),
'archives' => __('Item Archives', 'sp-basic'),
'attributes' => __('Item Attributes', 'sp-basic'),
'parent_item_colon' => __('Parent Item:', 'sp-basic'),
'all_items' => __('All Items', 'sp-basic'),
'add_new_item' => __('Add New Item', 'sp-basic'),
'add_new' => __('Add New', 'sp-basic'),
'new_item' => __('New Item', 'sp-basic'),
'edit_item' => __('Edit Item', 'sp-basic'),
'update_item' => __('Update Item', 'sp-basic'),
'view_item' => __('View Item', 'sp-basic'),
'view_items' => __('View Items', 'sp-basic'),
'search_items' => __('Search Item', 'sp-basic'),
'not_found' => __('Not found', 'sp-basic'),
'not_found_in_trash' => __('Not found in Trash', 'sp-basic'),
'featured_image' => __('Featured Image', 'sp-basic'),
'set_featured_image' => __('Set featured image', 'sp-basic'),
'remove_featured_image' => __('Remove featured image', 'sp-basic'),
'use_featured_image' => __('Use as featured image', 'sp-basic'),
'insert_into_item' => __('Insert into item', 'sp-basic'),
'uploaded_to_this_item' => __('Uploaded to this item', 'sp-basic'),
'items_list' => __('Items list', 'sp-basic'),
'items_list_navigation' => __('Items list navigation', 'sp-basic'),
'filter_items_list' => __('Filter items list', 'sp-basic'),
);
$args = array(
'label' => __('Запрос', 'sp-basic'),
'description' => __('Тип записи запросы клиентов', 'sp-basic'),
'labels' => $labels,
'supports' => array('title', 'editor', 'custom-fields'),
'taxonomies' => array('post_tag'),
'hierarchical' => true,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'menu_icon' => 'dashicons-admin-users',
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'post',
'show_in_rest' => true,
'query_var' => true,
);
register_post_type('zapros', $args);
}
add_action('init', 'register_cpt_zapros', 0);
}