/** * All code that runs when our plugin is first activated. * * We're going to register all the custom post types and taxonomies we'll need. * We'll all set up permalinks (@todo) and add some default content (@todo) so we have a country list to start. * * @package Wanderlist */ function wanderlist_custom_data() { /** * First, we're going to register a 'location' Custom Post Type. * This forms the basis of our plugin. */ $location_labels = array('name' => _x('Places', 'Post Type General Name', 'wanderlist'), 'singular_name' => _x('Place', 'Post Type Singular Name', 'wanderlist'), 'menu_name' => __('Wanderlist', 'wanderlist'), 'all_items' => __('Places', 'wanderlist'), 'new_item_name' => __('New Place', 'wanderlist'), 'add_new_item' => __('Add New Place', 'wanderlist'), 'edit_item' => __('Edit Place', 'wanderlist'), 'update_item' => __('Update Place', 'wanderlist'), 'view_item' => __('View Place', 'wanderlist'), 'not_found' => __('Not Found', 'wanderlist')); $location_args = array('label' => __('place', 'wanderlist'), 'description' => __('Places you have been and places you are.', 'wanderlist'), 'menu_icon' => 'dashicons-location', 'labels' => $location_labels, 'supports' => array(), 'taxonomies' => array('post_tag', 'wanderlist-trip', 'wanderlist-country'), 'hierarchical' => false, 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'menu_position' => 5, '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', 'rewrite' => array('slug' => 'places'), 'register_meta_box_cb' => 'wanderlist_extra_metaboxes', 'supports' => array('title', 'editor', 'thumbnail', 'excerpt')); register_post_type('wanderlist-location', $location_args); /** * Register countries as a taxonomy, so we can count 'em. */ $country_labels = array('name' => _x('Countries', 'Taxonomy General Name', 'wanderlist'), 'singular_name' => _x('Country', 'Taxonomy Singular Name', 'wanderlist'), 'menu_name' => __('Countries', 'wanderlist'), 'all_items' => __('All Countries', 'wanderlist'), 'parent_item' => __('Parent Country', 'wanderlist'), 'parent_item_colon' => __('Parent Country:', 'wanderlist'), 'new_item_name' => __('New Country Name', 'wanderlist'), 'add_new_item' => __('Add New Country', 'wanderlist'), 'edit_item' => __('Edit Country', 'wanderlist'), 'update_item' => __('Update Country', 'wanderlist'), 'view_item' => __('View Country', 'wanderlist'), 'separate_items_with_commas' => __('Separate countries with commas', 'wanderlist'), 'add_or_remove_items' => __('Add or remove countries', 'wanderlist'), 'choose_from_most_used' => __('Choose from the most used', 'wanderlist'), 'popular_items' => __('Popular Countries', 'wanderlist'), 'search_items' => __('Search Countries', 'wanderlist'), 'not_found' => __('Not Found', 'wanderlist')); $country_args = array('labels' => $country_labels, 'hierarchical' => true, 'public' => true, 'show_ui' => false, 'show_admin_column' => false, 'show_in_nav_menus' => true, 'show_tagcloud' => true); register_taxonomy('wanderlist-country', array('post', 'wanderlist-location'), $country_args); register_taxonomy_for_object_type('wanderlist-country', 'wanderlist-location'); /** * Register a taxonomy for trips, so we can map out a particular trip. * This just allows us an easy way to group locations and travels into * different trips. * At some point, we'll add functionality to show full details of a * particular trip. */ $trip_labels = array('name' => _x('Trips', 'Taxonomy General Name', 'wanderlist'), 'singular_name' => _x('Trip', 'Taxonomy Singular Name', 'wanderlist'), 'menu_name' => __('Trips', 'wanderlist'), 'all_items' => __('All Trips', 'wanderlist'), 'new_item_name' => __('New Trip Name', 'wanderlist'), 'add_new_item' => __('Add New Trip', 'wanderlist'), 'edit_item' => __('Edit Trip', 'wanderlist'), 'update_item' => __('Update Trip', 'wanderlist'), 'view_item' => __('View Trip', 'wanderlist'), 'separate_items_with_commas' => __('Separate trips with commas', 'wanderlist'), 'add_or_remove_items' => __('Add or remove trips', 'wanderlist'), 'choose_from_most_used' => __('Choose from the most used trips', 'wanderlist'), 'popular_items' => __('Popular trips', 'wanderlist'), 'search_items' => __('Search trips', 'wanderlist'), 'not_found' => __('Not Found', 'wanderlist')); $trip_args = array('labels' => $trip_labels, 'hierarchical' => true, 'public' => true, 'show_ui' => true, 'show_admin_column' => true, 'show_in_nav_menus' => true, 'show_tagcloud' => true); register_taxonomy('wanderlist-trip', array('post', 'wanderlist-location'), $trip_args); register_taxonomy_for_object_type('wanderlist-trip', 'wanderlist-location'); }
function create_slider_taxonomies() { // Add new taxonomy, make it hierarchical (like categories) $labels = array('name' => _x('Slider', 'taxonomy general name'), 'singular_name' => _x('Slider', 'taxonomy singular name'), 'search_items' => __('Search Slider'), 'all_items' => __('All Slider'), 'parent_item' => __('Parent Slider'), 'parent_item_colon' => __('Parent Slider:'), 'edit_item' => __('Edit Slider'), 'update_item' => __('Update Slider'), 'add_new_item' => __('Add New Slider'), 'new_item_name' => __('New Slider Name'), 'menu_name' => __('Category')); $args = array('hierarchical' => true, 'labels' => $labels, 'show_ui' => true, 'show_admin_column' => true, 'query_var' => true, 'rewrite' => array('slug' => 'slider')); register_taxonomy('slider', array('slider'), $args); }
function register_custom_post_types() { /* Register custom post types *****************************/ register_post_type('news', array('public' => true, 'publicly_queryable' => true, 'has_archive' => true, 'hierarchical' => false, 'menu_icon' => get_stylesheet_directory_uri() . '/images/news-icon.png', 'labels' => array('name' => _x('Новости', 'post type general name'), 'singular_name' => _x('Новость', 'post type singular name'), 'add_new' => _x('Добавить новую', 'Новость'), 'add_new_item' => __('Добавить новую новость'), 'edit_item' => __('Редактировать новость'), 'new_item' => __('Новая новость'), 'view_item' => __('Посмотреть новость'), 'search_items' => __('Поиск новостей'), 'not_found' => __('Новостей не найдено'), 'not_found_in_trash' => __('Новостей не найдено в корзине'), 'parent_item_colon' => ''), 'show_ui' => true, 'menu_position' => 5, 'show_in_nav_menus' => false, 'query_var' => true, 'rewrite' => true, 'rewrite' => array('slug' => 'nitem', 'with_front' => FALSE), 'register_meta_box_cb' => 'news_add_box', 'supports' => array('title', 'thumbnail', 'excerpt', 'editor', 'author', 'comments'))); register_post_type('banners', array('public' => true, 'publicly_queryable' => true, 'has_archive' => false, 'hierarchical' => false, 'menu_icon' => get_stylesheet_directory_uri() . '/images/banners-icon.png', 'labels' => array('name' => _x('Баннеры', 'post type general name'), 'singular_name' => _x('Баннер', 'post type singular name'), 'add_new' => _x('Добавить новый', 'Баннер'), 'add_new_item' => __('Добавить новый баннер'), 'edit_item' => __('Редактировать баннер'), 'new_item' => __('Новый баннер'), 'view_item' => __('Посмотреть баннер'), 'search_items' => __('Поиск баннеров'), 'not_found' => __('Баннеры не найдены'), 'not_found_in_trash' => __('Корзина пуста'), 'parent_item_colon' => ''), 'show_ui' => true, 'menu_position' => 5, 'show_in_nav_menus' => false, 'query_var' => true, 'rewrite' => true, 'rewrite' => array('slug' => 'banners', 'with_front' => FALSE), 'supports' => array('title'))); register_post_type('ads', array('public' => true, 'publicly_queryable' => true, 'has_archive' => true, 'hierarchical' => false, 'menu_icon' => get_stylesheet_directory_uri() . '/images/adsa_icon.png', 'labels' => array('name' => _x('Объявления', 'post type general name'), 'singular_name' => _x('Объявление', 'post type singular name'), 'add_new' => _x('Добавить новое', 'Объявление'), 'add_new_item' => __('Добавить новое объявление'), 'edit_item' => __('Редактировать объявление'), 'new_item' => __('Новое объявление'), 'view_item' => __('Посмотреть объявление'), 'search_items' => __('Поиск объявлений'), 'not_found' => __('Объявления не найдены'), 'not_found_in_trash' => __('Корзина пуста'), 'parent_item_colon' => ''), 'show_ui' => true, 'menu_position' => 5, 'show_in_nav_menus' => false, 'query_var' => true, 'rewrite' => true, 'rewrite' => array('slug' => 'ads', 'with_front' => FALSE), 'register_meta_box_cb' => 'ads_add_box', 'supports' => array('title', 'thumbnail', 'editor', 'author', 'comments'))); register_post_type('catalog', array('public' => true, 'publicly_queryable' => true, 'has_archive' => true, 'hierarchical' => false, 'menu_icon' => get_stylesheet_directory_uri() . '/images/catalog_icon.png', 'labels' => array('name' => _x('Справочник', 'post type general name'), 'singular_name' => _x('Организация', 'post type singular name'), 'add_new' => _x('Добавить организацию', 'Организация'), 'add_new_item' => __('Добавить новую организацию'), 'edit_item' => __('Редактировать организацию'), 'new_item' => __('Новая организация'), 'view_item' => __('Посмотреть организацию'), 'search_items' => __('Поиск организаций'), 'not_found' => __('Организации не найдены'), 'not_found_in_trash' => __('Корзина пуста'), 'parent_item_colon' => ''), 'show_ui' => true, 'menu_position' => 5, 'show_in_nav_menus' => false, 'query_var' => true, 'rewrite' => true, 'rewrite' => array('slug' => 'catalog', 'with_front' => FALSE), 'register_meta_box_cb' => 'cat_add_box', 'supports' => array('title', 'thumbnail', 'editor', 'author', 'comments'))); register_post_type('people', array('public' => true, 'publicly_queryable' => true, 'has_archive' => true, 'hierarchical' => false, 'menu_icon' => get_stylesheet_directory_uri() . '/images/drs-icon.png', 'labels' => array('name' => _x('Врачи', 'post type general name'), 'singular_name' => _x('Врач', 'post type singular name'), 'add_new' => _x('Добавить врача', 'врач'), 'add_new_item' => __('Добавить нового врача'), 'edit_item' => __('Редактировать запись'), 'new_item' => __('Новый врач'), 'view_item' => __('Посмотреть запись'), 'search_items' => __('Поиск врача'), 'not_found' => __('Записи не найдены'), 'not_found_in_trash' => __('Корзина пуста'), 'parent_item_colon' => ''), 'show_ui' => true, 'menu_position' => 5, 'show_in_nav_menus' => false, 'query_var' => true, 'rewrite' => true, 'register_meta_box_cb' => 'pl_add_box', 'rewrite' => array('slug' => 'people', 'with_front' => FALSE), 'supports' => array('title', 'editor', 'thumbnail', 'comments'))); /*Новости АВТОМАБИЛКИ начало*/ register_post_type('som', array('public' => true, 'publicly_queryable' => true, 'has_archive' => true, 'hierarchical' => false, 'menu_icon' => get_stylesheet_directory_uri() . '/images/car-icon.png', 'labels' => array('name' => _x('Somicadze', 'post type general name'), 'singular_name' => _x('Som', 'post type singular name'), 'add_new' => _x('Добавить запись', 'новость'), 'add_new_item' => __('Добавить новую запись'), 'edit_item' => __('Редактировать запись'), 'new_item' => __('Новая запись'), 'view_item' => __('Посмотреть запись'), 'search_items' => __('Поиск записей'), 'not_found' => __('Запись не найдена'), 'not_found_in_trash' => __('Корзина пуста'), 'parent_item_colon' => ''), 'show_ui' => true, 'menu_position' => 6, 'show_in_nav_menus' => false, 'query_var' => true, 'rewrite' => true, 'rewrite' => array('slug' => 'somnews', 'with_front' => FALSE), 'supports' => array('title', 'thumbnail', 'excerpt', 'editor', 'author', 'comments'))); /* Register custom taxonomies *****************************/ $labelsTags = array('name' => _x('Метки', 'taxonomy general name'), 'singular_name' => _x('Метки', 'taxonomy singular name'), 'search_items' => __('Поиск меток'), 'all_items' => __('Все метки'), 'edit_item' => __('Редактировать метку'), 'update_item' => __('Обновить метку'), 'add_new_item' => __('Добавить новую метку'), 'new_item_name' => __('Новая метка')); register_taxonomy('ntag', array('news'), array('hierarchical' => false, 'labels' => $labelsTags, 'show_ui' => 'radio', 'show_in_nav_menus' => false, 'query_var' => true, 'rewrite' => array('slug' => 'ntag'))); $labelsCat = array('name' => _x('Рубрики новостей', 'taxonomy general name'), 'singular_name' => _x('Рубрика', 'taxonomy singular name'), 'search_items' => __('Поиск рубрик'), 'all_items' => __('Все рубрики'), 'parent_item' => __('Родительская рубрика'), 'parent_item_colon' => __('Родительская рубрика:'), 'edit_item' => __('Редактировать рубрику'), 'update_item' => __('Обновить рубрику'), 'add_new_item' => __('Добавить новую рубрику'), 'new_item_name' => __('Новая рубрика')); register_taxonomy('ncategory', array('news'), array('hierarchical' => true, 'labels' => $labelsCat, 'show_ui' => 'radio', 'query_var' => true, 'rewrite' => array('slug' => 'ncategory'))); $labelsLoc = array('name' => _x('Регионы', 'taxonomy general name'), 'singular_name' => _x('Регион', 'taxonomy singular name'), 'search_items' => __('Поиск региона'), 'all_items' => __('Все регионы'), 'parent_item' => __('Родительский регион'), 'parent_item_colon' => __('Родительский регион:'), 'edit_item' => __('Редактировать регион'), 'update_item' => __('Обновить регион'), 'add_new_item' => __('Добавить новый регион'), 'new_item_name' => __('Новый регион')); register_taxonomy('nlocation', array('news', 'ads', 'catalog'), array('public' => true, 'hierarchical' => true, 'labels' => $labelsLoc, 'query_var' => 'nlocation', 'show_ui' => true, 'rewrite' => array('slug' => 'nlocation', 'with_front' => false))); $labelsAdsCat = array('name' => _x('Категории объявлений', 'taxonomy general name'), 'singular_name' => _x('Категория', 'taxonomy singular name'), 'search_items' => __('Поиск категории'), 'all_items' => __('Все категории'), 'parent_item' => __('Родительская категория'), 'parent_item_colon' => __('Родительская категория:'), 'edit_item' => __('Редактировать категорию'), 'update_item' => __('Обновить категорию'), 'add_new_item' => __('Добавить новую категорию'), 'new_item_name' => __('Новая категория')); register_taxonomy('adscategory', 'ads', array('public' => true, 'hierarchical' => true, 'labels' => $labelsAdsCat, 'query_var' => 'adscategory', 'show_ui' => true, 'rewrite' => array('slug' => 'adscategory', 'with_front' => false))); $labelsCatalogCat = array('name' => _x('Разделы справочника', 'taxonomy general name'), 'singular_name' => _x('Раздел', 'taxonomy singular name'), 'search_items' => __('Поиск разделов'), 'all_items' => __('Все разделы'), 'parent_item' => __('Родительский раздел'), 'parent_item_colon' => __('Родительский раздел:'), 'edit_item' => __('Редактировать раздел'), 'update_item' => __('Обновить раздел'), 'add_new_item' => __('Добавить новый раздел'), 'new_item_name' => __('Новый раздел')); register_taxonomy('catcategory', 'catalog', array('public' => true, 'hierarchical' => true, 'labels' => $labelsCatalogCat, 'query_var' => 'catcategory', 'show_ui' => true, 'rewrite' => array('slug' => 'catcategory', 'with_front' => false))); $labelsMedicalNewsCat = array('name' => _x('Тип', 'taxonomy general name'), 'singular_name' => _x('Тип', 'taxonomy singular name'), 'search_items' => __('Поиск типов'), 'all_items' => __('Все типы'), 'parent_item' => __('Родительский пункт'), 'parent_item_colon' => __('Родительский пункт:'), 'edit_item' => __('Редактировать'), 'update_item' => __('Обновить'), 'add_new_item' => __('Добавить новый'), 'new_item_name' => __('Новый')); register_taxonomy('medcat', 'medicalnews', array('public' => true, 'hierarchical' => true, 'show_in_nav_menus' => false, 'labels' => $labelsMedicalNewsCat, 'query_var' => 'medcat', 'show_ui' => true, 'rewrite' => array('slug' => 'medcat', 'with_front' => false))); $labelsSomCat = array('name' => _x('Разделы', 'taxonomy general name'), 'singular_name' => _x('Раздел', 'taxonomy singular name'), 'search_items' => __('Поиск разделов'), 'all_items' => __('Все разделы'), 'parent_item' => __('Родительский пункт'), 'parent_item_colon' => __('Родительский пункт:'), 'edit_item' => __('Редактировать'), 'update_item' => __('Обновить'), 'add_new_item' => __('Добавить новый'), 'new_item_name' => __('Новый')); register_taxonomy('somcat', 'som', array('public' => true, 'hierarchical' => true, 'show_in_nav_menus' => false, 'labels' => $labelsSomCat, 'query_var' => 'somcat', 'show_ui' => true, 'rewrite' => array('slug' => 'somcat', 'with_front' => false))); }
/** * Register core taxonomies. */ public static function register_taxonomies() { if (taxonomy_exists('product_type')) { return; } do_action('woocommerce_register_taxonomy'); $permalinks = get_option('woocommerce_permalinks'); register_taxonomy('product_type', apply_filters('woocommerce_taxonomy_objects_product_type', array('product')), apply_filters('woocommerce_taxonomy_args_product_type', array('hierarchical' => false, 'show_ui' => false, 'show_in_nav_menus' => false, 'query_var' => is_admin(), 'rewrite' => false, 'public' => false))); register_taxonomy('product_cat', apply_filters('woocommerce_taxonomy_objects_product_cat', array('product')), apply_filters('woocommerce_taxonomy_args_product_cat', array('hierarchical' => true, 'update_count_callback' => '_wc_term_recount', 'label' => __('Product Categories', 'woocommerce'), 'labels' => array('name' => __('Product Categories', 'woocommerce'), 'singular_name' => __('Product Category', 'woocommerce'), 'menu_name' => _x('Categories', 'Admin menu name', 'woocommerce'), 'search_items' => __('Search Product Categories', 'woocommerce'), 'all_items' => __('All Product Categories', 'woocommerce'), 'parent_item' => __('Parent Product Category', 'woocommerce'), 'parent_item_colon' => __('Parent Product Category:', 'woocommerce'), 'edit_item' => __('Edit Product Category', 'woocommerce'), 'update_item' => __('Update Product Category', 'woocommerce'), 'add_new_item' => __('Add New Product Category', 'woocommerce'), 'new_item_name' => __('New Product Category Name', 'woocommerce')), 'show_ui' => true, 'query_var' => true, 'capabilities' => array('manage_terms' => 'manage_product_terms', 'edit_terms' => 'edit_product_terms', 'delete_terms' => 'delete_product_terms', 'assign_terms' => 'assign_product_terms'), 'rewrite' => array('slug' => empty($permalinks['category_base']) ? _x('product-category', 'slug', 'woocommerce') : $permalinks['category_base'], 'with_front' => false, 'hierarchical' => true)))); register_taxonomy('product_tag', apply_filters('woocommerce_taxonomy_objects_product_tag', array('product')), apply_filters('woocommerce_taxonomy_args_product_tag', array('hierarchical' => false, 'update_count_callback' => '_wc_term_recount', 'label' => __('Product Tags', 'woocommerce'), 'labels' => array('name' => __('Product Tags', 'woocommerce'), 'singular_name' => __('Product Tag', 'woocommerce'), 'menu_name' => _x('Tags', 'Admin menu name', 'woocommerce'), 'search_items' => __('Search Product Tags', 'woocommerce'), 'all_items' => __('All Product Tags', 'woocommerce'), 'edit_item' => __('Edit Product Tag', 'woocommerce'), 'update_item' => __('Update Product Tag', 'woocommerce'), 'add_new_item' => __('Add New Product Tag', 'woocommerce'), 'new_item_name' => __('New Product Tag Name', 'woocommerce'), 'popular_items' => __('Popular Product Tags', 'woocommerce'), 'separate_items_with_commas' => __('Separate Product Tags with commas', 'woocommerce'), 'add_or_remove_items' => __('Add or remove Product Tags', 'woocommerce'), 'choose_from_most_used' => __('Choose from the most used Product tags', 'woocommerce'), 'not_found' => __('No Product Tags found', 'woocommerce')), 'show_ui' => true, 'query_var' => true, 'capabilities' => array('manage_terms' => 'manage_product_terms', 'edit_terms' => 'edit_product_terms', 'delete_terms' => 'delete_product_terms', 'assign_terms' => 'assign_product_terms'), 'rewrite' => array('slug' => empty($permalinks['tag_base']) ? _x('product-tag', 'slug', 'woocommerce') : $permalinks['tag_base'], 'with_front' => false)))); register_taxonomy('product_shipping_class', apply_filters('woocommerce_taxonomy_objects_product_shipping_class', array('product', 'product_variation')), apply_filters('woocommerce_taxonomy_args_product_shipping_class', array('hierarchical' => true, 'update_count_callback' => '_update_post_term_count', 'label' => __('Shipping Classes', 'woocommerce'), 'labels' => array('name' => __('Shipping Classes', 'woocommerce'), 'singular_name' => __('Shipping Class', 'woocommerce'), 'menu_name' => _x('Shipping Classes', 'Admin menu name', 'woocommerce'), 'search_items' => __('Search Shipping Classes', 'woocommerce'), 'all_items' => __('All Shipping Classes', 'woocommerce'), 'parent_item' => __('Parent Shipping Class', 'woocommerce'), 'parent_item_colon' => __('Parent Shipping Class:', 'woocommerce'), 'edit_item' => __('Edit Shipping Class', 'woocommerce'), 'update_item' => __('Update Shipping Class', 'woocommerce'), 'add_new_item' => __('Add New Shipping Class', 'woocommerce'), 'new_item_name' => __('New Shipping Class Name', 'woocommerce')), 'show_ui' => false, 'show_in_nav_menus' => false, 'query_var' => is_admin(), 'capabilities' => array('manage_terms' => 'manage_product_terms', 'edit_terms' => 'edit_product_terms', 'delete_terms' => 'delete_product_terms', 'assign_terms' => 'assign_product_terms'), 'rewrite' => false))); global $wc_product_attributes; $wc_product_attributes = array(); if ($attribute_taxonomies = wc_get_attribute_taxonomies()) { foreach ($attribute_taxonomies as $tax) { if ($name = wc_attribute_taxonomy_name($tax->attribute_name)) { $tax->attribute_public = absint(isset($tax->attribute_public) ? $tax->attribute_public : 1); $label = !empty($tax->attribute_label) ? $tax->attribute_label : $tax->attribute_name; $wc_product_attributes[$name] = $tax; $taxonomy_data = array('hierarchical' => true, 'update_count_callback' => '_update_post_term_count', 'labels' => array('name' => $label, 'singular_name' => $label, 'search_items' => sprintf(__('Search %s', 'woocommerce'), $label), 'all_items' => sprintf(__('All %s', 'woocommerce'), $label), 'parent_item' => sprintf(__('Parent %s', 'woocommerce'), $label), 'parent_item_colon' => sprintf(__('Parent %s:', 'woocommerce'), $label), 'edit_item' => sprintf(__('Edit %s', 'woocommerce'), $label), 'update_item' => sprintf(__('Update %s', 'woocommerce'), $label), 'add_new_item' => sprintf(__('Add New %s', 'woocommerce'), $label), 'new_item_name' => sprintf(__('New %s', 'woocommerce'), $label)), 'show_ui' => false, 'query_var' => 1 === $tax->attribute_public, 'rewrite' => false, 'sort' => false, 'public' => 1 === $tax->attribute_public, 'show_in_nav_menus' => 1 === $tax->attribute_public && apply_filters('woocommerce_attribute_show_in_nav_menus', false, $name), 'capabilities' => array('manage_terms' => 'manage_product_terms', 'edit_terms' => 'edit_product_terms', 'delete_terms' => 'delete_product_terms', 'assign_terms' => 'assign_product_terms')); if (1 === $tax->attribute_public) { $taxonomy_data['rewrite'] = array('slug' => empty($permalinks['attribute_base']) ? '' : trailingslashit($permalinks['attribute_base']) . sanitize_title($tax->attribute_name), 'with_front' => false, 'hierarchical' => true); } register_taxonomy($name, apply_filters("woocommerce_taxonomy_objects_{$name}", array('product')), apply_filters("woocommerce_taxonomy_args_{$name}", $taxonomy_data)); } } do_action('woocommerce_after_register_taxonomy'); } }
function create_article_taxonomies() { $nice_category_labels = array('name' => __('Categories', 'nicethemes'), 'singular_name' => __('Category', 'nicethemes'), 'search_items' => __('Categories', 'nicethemes'), 'all_items' => __('All Categories', 'nicethemes'), 'parent_item' => __('Parent Category', 'nicethemes'), 'parent_item_colon' => __('Parent Category:', 'nicethemes'), 'edit_item' => __('Edit Category', 'nicethemes'), 'update_item' => __('Update Category', 'nicethemes'), 'add_new_item' => __('Add New Category', 'nicethemes'), 'new_item_name' => __('New Category', 'nicethemes')); register_taxonomy('article-category', array('article'), array('hierarchical' => true, 'labels' => $nice_category_labels, 'show_ui' => true, 'query_var' => true, 'rewrite' => array('slug' => 'article-category'))); $nice_tag_labels = array('name' => __('Tags', 'nicethemes'), 'singular_name' => __('Tag', 'nicethemes'), 'search_items' => __('Tags', 'nicethemes'), 'all_items' => __('All Tags', 'nicethemes'), 'parent_item' => __('Parent Tag', 'nicethemes'), 'parent_item_colon' => __('Parent Tag:', 'nicethemes'), 'edit_item' => __('Edit Tag', 'nicethemes'), 'update_item' => __('Update Tag', 'nicethemes'), 'add_new_item' => __('Add New Tag', 'nicethemes'), 'new_item_name' => __('New Tag', 'nicethemes')); register_taxonomy('article-tag', array('article', 'faq'), array('hierarchical' => false, 'labels' => $nice_tag_labels, 'show_ui' => true, 'query_var' => true, 'rewrite' => array('slug' => 'article-tag'))); }
public function setUp() { global $wpdb; parent::setUp(); register_taxonomy('edu_test_tax_1', 'post'); register_taxonomy('edu_test_tax_2', 'post'); $t1 = wp_insert_term('Edu', 'edu_test_tax_1'); $t2 = wp_insert_term('Edu', 'edu_test_tax_2'); $t3 = wp_insert_term('Edu', 'ib_educator_category'); $t4 = wp_insert_term('Mathematics', 'ib_educator_category'); // Arbitrary term. $wpdb->update($wpdb->term_taxonomy, array('term_id' => $t1['term_id']), array('term_taxonomy_id' => $t2['term_taxonomy_id']), array('%d'), array('%d')); $wpdb->update($wpdb->term_taxonomy, array('term_id' => $t1['term_id']), array('term_taxonomy_id' => $t3['term_taxonomy_id']), array('%d'), array('%d')); $t2['term_id'] = $t1['term_id']; $t3['term_id'] = $t1['term_id']; // Create membership. $post_id = wp_insert_post(array('post_type' => 'ib_edu_membership', 'post_name' => 'edu-membership-1', 'post_title' => 'edu membership 1', 'post_status' => 'publish')); $ms = Edr_Memberships::get_instance(); $meta = $ms->get_membership_meta(); $meta['price'] = '10.05'; $meta['period'] = ''; $meta['duration'] = ''; $meta['categories'] = array($t3['term_id'], $t4['term_id']); update_post_meta($post_id, '_ib_educator_membership', $meta); $this->posts[] = $post_id; $this->terms = array('term1' => $t1, 'term2' => $t2, 'term3' => $t3, 'term4' => $t4); }
function create_candidate_disciplines_taxonomies() { // Add new taxonomy, make it hierarchical (like categories) $labels = array('name' => _x('Disciplines', 'taxonomy general name'), 'singular_name' => _x('Discipline', 'taxonomy singular name'), 'search_items' => __('Search Disciplines'), 'all_items' => __('All Disciplines'), 'parent_item' => __('Parent Discipline'), 'parent_item_colon' => __('Parent Industry'), 'edit_item' => __('Edit Discipline'), 'update_item' => __('Update Disciplines'), 'add_new_item' => __('Add New Discipline'), 'new_item_name' => __('New Disciplines'), 'menu_name' => __('Disciplines')); $args = array('hierarchical' => true, 'labels' => $labels, 'show_ui' => true, 'show_admin_column' => true, 'query_var' => true, 'rewrite' => array('slug' => 'discipline')); register_taxonomy('disciplines', array('associate'), $args); }
public function _registerTaxonomy($sTaxonomySlug, array $aObjectTypes, array $aArguments) { if (!in_array($this->oProp->sPostType, $aObjectTypes)) { $aObjectTypes[] = $this->oProp->sPostType; } register_taxonomy($sTaxonomySlug, array_unique($aObjectTypes), $aArguments); }
function portfolio_industries_init() { register_taxonomy( 'Industry', 'portfolio', array( 'label' => __( 'Industries' ), 'rewrite' => array( 'slug' => 'industry', 'show_ui' => true, ), 'hierarchical' => true, ) ); register_taxonomy( 'Services', 'portfolio', array( 'label' => __( 'Services' ), 'rewrite' => array( 'slug' => 'service', 'show_ui' => true, ), 'hierarchical' => true, ) ); }
function project_classification_tax() { // Add new taxonomy, make it hierarchical (like categories) $labels = array('name' => _x('Classification', 'taxonomy general name'), 'singular_name' => _x('Classification', 'taxonomy singular name'), 'search_items' => __('Search Classifications'), 'all_items' => __('All Classifications'), 'parent_item' => __('Parent Classification'), 'parent_item_colon' => __('Parent Classification:'), 'edit_item' => __('Edit Classification'), 'update_item' => __('Update Classification'), 'add_new_item' => __('Add New Classification'), 'new_item_name' => __('New Classification Name'), 'menu_name' => __('Classification')); $args = array('hierarchical' => true, 'labels' => $labels, 'show_ui' => true, 'show_admin_column' => true, 'show_in_quick_edit' => false, 'query_var' => true, 'rewrite' => array('slug' => 'project-classifications')); register_taxonomy('project_classification', array('project'), $args); }
function go_register_task_tax_and_cpt() { /* * Task Category Taxonomy */ $task_cat_labels = array('name' => _x(go_return_options('go_tasks_name') . ' Categories', 'task_categories'), 'singular_name' => _x(go_return_options('go_tasks_name') . ' Category', 'task_categories'), 'search_items' => _x('Search ' . go_return_options('go_tasks_name') . ' Categories', 'task_categories'), 'popular_items' => _x('Popular ' . go_return_options('go_tasks_name') . ' Categories', 'task_categories'), 'all_items' => _x('All ' . go_return_options('go_tasks_name') . ' Categories', 'task_categories'), 'parent_item' => _x(go_return_options('go_tasks_name') . ' Category Parent', 'task_categories'), 'parent_item_colon' => _x('Parent ' . go_return_options('go_tasks_name') . ' Category:', 'task_categories'), 'edit_item' => _x('Edit ' . go_return_options('go_tasks_name') . ' Category', 'task_categories'), 'update_item' => _x('Update ' . go_return_options('go_tasks_name') . ' Category', 'task_categories'), 'add_new_item' => _x('Add New ' . go_return_options('go_tasks_name') . ' Category', 'task_categories'), 'new_item_name' => _x('New ' . go_return_options('go_tasks_name') . ' Category', 'task_categories'), 'separate_items_with_commas' => _x('Separate ' . go_return_options('go_tasks_name') . ' categories with commas', 'task_categories'), 'add_or_remove_items' => _x('Add or remove ' . go_return_options('go_tasks_name') . ' categories', 'task_categories'), 'choose_from_most_used' => _x('Choose from the most used ' . go_return_options('go_tasks_name') . ' categories', 'task_categories'), 'menu_name' => _x(go_return_options('go_tasks_name') . ' Categories', 'task_categories')); $task_cat_args = array('labels' => $task_cat_labels, 'public' => true, 'show_in_nav_menus' => true, 'show_ui' => true, 'show_tagcloud' => true, 'show_admin_column' => false, 'hierarchical' => true, 'rewrite' => true, 'query_var' => true); register_taxonomy('task_categories', array('tasks'), $task_cat_args); /* * Task Focus Categories Taxonomy */ $focus_labels = array('name' => _x(go_return_options('go_focus_name') . ' Categories', 'task_focus_categories'), 'singular_name' => _x(go_return_options('go_focus_name') . ' Category', 'task_focus_categories'), 'search_items' => _x('Search ' . go_return_options('go_focus_name') . ' Categories', 'task_focus_categories'), 'popular_items' => _x('Popular ' . go_return_options('go_focus_name') . ' Categories', 'task_focus_categories'), 'all_items' => _x('All ' . go_return_options('go_focus_name') . ' Categories', 'task_focus_categories'), 'parent_item' => _x(go_return_options('go_focus_name') . ' Category Parent', 'task_focus_categories'), 'parent_item_colon' => _x('Parent ' . go_return_options('go_focus_name') . ' Category:', 'task_focus_categories'), 'edit_item' => _x('Edit ' . go_return_options('go_focus_name') . ' Category', 'task_focus_categories'), 'update_item' => _x('Update ' . go_return_options('go_focus_name') . ' Category', 'task_focus_categories'), 'add_new_item' => _x('Add New ' . go_return_options('go_focus_name') . ' Category', 'task_focus_categories'), 'new_item_name' => _x('New ' . go_return_options('go_focus_name') . ' Category', 'task_focus_categories'), 'separate_items_with_commas' => _x('Separate ' . go_return_options('go_focus_name') . ' categories with commas', 'task_focus_categories'), 'add_or_remove_items' => _x('Add or remove ' . go_return_options('go_focus_name') . ' categories', 'task_focus_categories'), 'choose_from_most_used' => _x('Choose from the most used ' . go_return_options('go_focus_name') . ' categories', 'task_focus_categories'), 'menu_name' => _x(go_return_options('go_focus_name') . ' Categories', 'task_focus_categories')); $focus_args = array('labels' => $focus_labels, 'public' => true, 'show_in_nav_menus' => true, 'show_ui' => true, 'show_tagcloud' => true, 'show_admin_column' => false, 'hierarchical' => true, 'rewrite' => true, 'query_var' => true); register_taxonomy('task_focus_categories', array('tasks'), $focus_args); /* * Task Chains Taxonomy */ $task_chains_labels = array('name' => _x(go_return_options('go_tasks_name') . ' Chains', 'task_chains'), 'singular_name' => _x(go_return_options('go_tasks_name') . ' Chain', 'task_chains'), 'search_items' => _x('Search ' . go_return_options('go_tasks_name') . ' Chains', 'task_chains'), 'popular_items' => _x('Popular ' . go_return_options('go_tasks_name') . ' Chains', 'task_chains'), 'all_items' => _x('All ' . go_return_options('go_tasks_name') . ' Chains', 'task_chains'), 'parent_item' => _x(go_return_options('go_tasks_name') . ' Chain Parent', 'task_chains'), 'parent_item_colon' => _x('Parent ' . go_return_options('go_tasks_name') . ' Chain:', 'task_chains'), 'edit_item' => _x('Edit ' . go_return_options('go_tasks_name') . ' Chain', 'task_chains'), 'update_item' => _x('Update ' . go_return_options('go_tasks_name') . ' Chain', 'task_chains'), 'add_new_item' => _x('Add New ' . go_return_options('go_tasks_name') . ' Chain', 'task_chains'), 'new_item_name' => _x('New ' . go_return_options('go_tasks_name') . ' Chain', 'task_chains'), 'separate_items_with_commas' => _x('Separate ' . go_return_options('go_tasks_name') . ' chains with commas', 'task_chains'), 'add_or_remove_items' => _x('Add or remove ' . go_return_options('go_tasks_name') . ' chains', 'task_chains'), 'choose_from_most_used' => _x('Choose from the most used ' . go_return_options('go_tasks_name') . ' chains', 'task_chains'), 'menu_name' => _x(go_return_options('go_tasks_name') . ' Chains', 'task_chains')); $task_chains_args = array('labels' => $task_chains_labels, 'public' => true, 'show_in_nav_menus' => true, 'show_ui' => true, 'show_tagcloud' => true, 'show_admin_column' => false, 'hierarchical' => true, 'rewrite' => true, 'query_var' => true); register_taxonomy('task_chains', array('tasks'), $task_chains_args); /* * Task Pods Taxonomy */ $task_pods_labels = array('name' => _x(go_return_options('go_tasks_name') . ' Pods', 'task_pods'), 'singular_name' => _x(go_return_options('go_tasks_name') . ' Pod', 'task_pods'), 'search_items' => _x('Search ' . go_return_options('go_tasks_name') . ' Pods', 'task_pods'), 'popular_items' => _x('Popular ' . go_return_options('go_tasks_name') . ' Pods', 'task_pods'), 'all_items' => _x('All ' . go_return_options('go_tasks_name') . ' Pods', 'task_pods'), 'parent_item' => _x(go_return_options('go_tasks_name') . ' Pod Parent', 'task_pods'), 'parent_item_colon' => _x('Parent ' . go_return_options('go_tasks_name') . ' Pod:', 'task_pods'), 'edit_item' => _x('Edit ' . go_return_options('go_tasks_name') . ' Pod', 'task_pods'), 'update_item' => _x('Update ' . go_return_options('go_tasks_name') . ' Pod', 'task_pods'), 'add_new_item' => _x('Add New ' . go_return_options('go_tasks_name') . ' Pod', 'task_pods'), 'new_item_name' => _x('New ' . go_return_options('go_tasks_name') . ' Pod', 'task_pods'), 'separate_items_with_commas' => _x('Separate ' . go_return_options('go_tasks_name') . ' pods with commas', 'task_pods'), 'add_or_remove_items' => _x('Add or remove ' . go_return_options('go_tasks_name') . ' pods', 'task_pods'), 'choose_from_most_used' => _x('Choose from the most used ' . go_return_options('go_tasks_name') . ' pods', 'task_pods'), 'menu_name' => _x(go_return_options('go_tasks_name') . ' Pods', 'task_pods')); $task_pods_args = array('labels' => $task_pods_labels, 'public' => true, 'show_in_nav_menus' => true, 'show_ui' => true, 'show_tagcloud' => true, 'show_admin_column' => false, 'hierarchical' => true, 'rewrite' => true, 'query_var' => true); register_taxonomy('task_pods', array('tasks'), $task_pods_args); /* * Task Custom Post Type */ $labels_cpt = array('name' => _x(go_return_options('go_tasks_plural_name'), 'task'), 'singular_name' => _x(go_return_options('go_tasks_name'), 'task'), 'add_new' => _x('Add New ' . go_return_options('go_tasks_name'), 'task'), 'add_new_item' => _x('Add New ' . go_return_options('go_tasks_name'), 'task'), 'edit_item' => _x('Edit ' . go_return_options('go_tasks_name'), 'task'), 'new_item' => _x('New ' . go_return_options('go_tasks_name'), 'task'), 'view_item' => _x('View ' . go_return_options('go_tasks_name'), 'task'), 'search_items' => _x('Search ' . go_return_options('go_tasks_plural_name'), 'task'), 'not_found' => _x('No ' . go_return_options('go_tasks_plural_name') . ' found', 'task'), 'not_found_in_trash' => _x('No ' . go_return_options('go_tasks_plural_name') . ' found in Trash', 'task'), 'parent_item_colon' => _x('Parent ' . go_return_options('go_tasks_name') . ':', 'task'), 'menu_name' => _x(go_return_options('go_tasks_plural_name'), 'task')); $args_cpt = array('labels' => $labels_cpt, 'hierarchical' => false, 'description' => go_return_options('go_tasks_plural_name'), 'supports' => array('title', 'publicize', 'thumbnail', 'custom-fields', 'revisions', 'page-attributes', 'comments'), 'taxonomies' => array('task_categories', 'post_tag', 'task_focus_categories'), 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'menu_position' => 20, 'menu_icon' => plugins_url('images/ico.png', __FILE__), 'show_in_nav_menus' => true, 'exclude_from_search' => false, 'has_archive' => true, 'query_var' => true, 'can_export' => true, 'rewrite' => true, 'capability_type' => 'post'); register_post_type('tasks', $args_cpt); }
function dwqa_posttype_init() { global $dwqa_options; extract(dwqa_get_rewrite_slugs()); /* Question Posttype Registration */ $question_labels = array('name' => __('Question', 'dwqa'), 'singular_name' => __('Question', 'dwqa'), 'add_new' => __('Add New', 'theme'), 'add_new_item' => __('Add New Question', 'dwqa'), 'edit_item' => __('Edit Question'), 'new_item' => __('New Question', 'dwqa'), 'all_items' => __('All Questions', 'dwqa'), 'view_item' => __('View Question', 'dwqa'), 'search_items' => __('Search Question', 'dwqa'), 'not_found' => __('No questions found', 'dwqa'), 'not_found_in_trash' => __('No questions found in Trash', 'dwqa'), 'parent_item_colon' => '', 'menu_name' => __('DW Q&A', 'dwqa')); $question_args = array('labels' => $question_labels, 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'show_in_menu' => true, 'query_var' => true, 'rewrite' => array('slug' => $question_rewrite, 'with_front' => false), 'has_archive' => true, 'hierarchical' => true, 'menu_icon' => '', 'supports' => array('title', 'editor', 'comments', 'author', 'page-attributes')); register_post_type('dwqa-question', $question_args); /* Question Posttype Registration */ $answer_labels = array('name' => __('Answer', 'dwqa'), 'singular_name' => __('Answer', 'dwqa'), 'add_new' => __('Add New', 'dwqa'), 'add_new_item' => __('Add new answer', 'dwqa'), 'edit_item' => __('Edit answer', 'dwqa'), 'new_item' => __('New Answer', 'dwqa'), 'all_items' => __('All Answers', 'dwqa'), 'view_item' => __('View Answer', 'dwqa'), 'search_items' => __('Search Answer', 'dwqa'), 'not_found' => __('No Answers found', 'dwqa'), 'not_found_in_trash' => __('No Answers found in Trash', 'dwqa'), 'parent_item_colon' => '', 'menu_name' => __('Answer', 'dwqa')); $answer = array('labels' => $answer_labels, 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'show_in_menu' => 'edit.php?post_type=dwqa-question', 'query_var' => true, 'rewrite' => true, 'has_archive' => false, 'hierarchical' => true, 'menu_icon' => '', 'supports' => array('title', 'editor', 'comments', 'custom-fields', 'author', 'page-attributes')); register_post_type('dwqa-answer', $answer); // Question Taxonomies ( Tag, Category register for Question Posttype) // Question Categories $question_category_labels = array('name' => _x('Categories', 'taxonomy general name'), 'singular_name' => _x('Category', 'taxonomy singular name'), 'search_items' => __('Search Categories', 'dwqa'), 'all_items' => __('All Categories', 'dwqa'), 'parent_item' => __('Parent Category', 'dwqa'), 'parent_item_colon' => __('Parent Category:', 'dwqa'), 'edit_item' => __('Edit Category', 'dwqa'), 'update_item' => __('Update Category', 'dwqa'), 'add_new_item' => __('Add New Category', 'dwqa'), 'new_item_name' => __('New Category Name', 'dwqa'), 'menu_name' => __('Question Categories', 'dwqa')); register_taxonomy('dwqa-question_category', array('dwqa-question'), array('hierarchical' => true, 'labels' => $question_category_labels, 'show_ui' => true, 'query_var' => true, 'rewrite' => array('slug' => $question_category_rewrite, 'with_front' => false))); // Question Tags $question_tag_labels = array('name' => _x('Tags', 'taxonomy general name'), 'singular_name' => _x('Tag', 'taxonomy singular name'), 'search_items' => __('Search Tags', 'dwqa'), 'popular_items' => __('Popular Tags', 'dwqa'), 'all_items' => __('All Tags', 'dwqa'), 'parent_item' => null, 'parent_item_colon' => null, 'edit_item' => __('Edit Tag', 'dwqa'), 'update_item' => __('Update Tag', 'dwqa'), 'add_new_item' => __('Add New Tag', 'dwqa'), 'new_item_name' => __('New Tag Name', 'dwqa'), 'separate_items_with_commas' => __('Separate tags with commas', 'dwqa'), 'add_or_remove_items' => __('Add or remove tags', 'dwqa'), 'choose_from_most_used' => __('Choose from the most used tags', 'dwqa'), 'menu_name' => __('Question Tags', 'dwqa')); register_taxonomy('dwqa-question_tag', array('dwqa-question'), array('hierarchical' => false, 'labels' => $question_tag_labels, 'show_ui' => true, 'update_count_callback' => '_update_post_term_count', 'query_var' => true, 'rewrite' => array('slug' => $question_tag_rewrite, 'with_front' => false))); // Create default category for dwqa question type when dwqa plugin is actived $cats = get_categories(array('type' => 'dwqa-question', 'hide_empty' => 0, 'taxonomy' => 'dwqa-question_category')); if (empty($cats)) { wp_insert_term('Questions', 'dwqa-question_category'); } // update term rewrite rule dwqa_update_term_rewrite_rules(); }
function bluerock_property_category() { $labels = array('name' => _x('Types', 'Taxonomy General Name', 'text_domain'), 'singular_name' => _x('Type', 'Taxonomy Singular Name', 'text_domain'), 'menu_name' => __('Property Types', 'text_domain'), 'all_items' => __('All Property Types', 'text_domain'), 'parent_item' => __('Parent Property Type', 'text_domain'), 'parent_item_colon' => __('Parent Property Type:', 'text_domain'), 'new_item_name' => __('New Property Type', 'text_domain'), 'add_new_item' => __('Add Property Type', 'text_domain'), 'edit_item' => __('Edit Property Type', 'text_domain'), 'update_item' => __('Update Property Type', 'text_domain'), 'view_item' => __('View Property Type', 'text_domain'), 'separate_items_with_commas' => __('Separate items with commas', 'text_domain'), 'add_or_remove_items' => __('Add or remove Property Types', 'text_domain'), 'choose_from_most_used' => __('Choose from the most used', 'text_domain'), 'popular_items' => __('Popular Property Types', 'text_domain'), 'search_items' => __('Search Property Types', 'text_domain'), 'not_found' => __('Not Found', 'text_domain')); $rewrite2 = array('slug' => 'property', 'with_front' => true, 'pages' => true, 'feeds' => true); $args = array('labels' => $labels, 'hierarchical' => true, 'public' => true, 'show_ui' => true, 'show_admin_column' => true, 'show_in_nav_menus' => true, 'show_tagcloud' => false, 'query_var' => false, 'rewrite' => $rewrite2); register_taxonomy('type', array('portfolio'), $args); }
function gdlr_create_hostel_room() { global $theme_option; if (!empty($theme_option['hostel-room-slug'])) { $room_slug = $theme_option['hostel-room-slug']; $room_category_slug = $theme_option['hostel-room-category-slug']; $room_tag_slug = $theme_option['hostel-room-tag-slug']; } else { $room_slug = 'hostel_room'; $room_category_slug = 'hostel_room_category'; $room_tag_slug = 'hostel_room_tag'; } register_post_type('hostel_room', array('labels' => array('name' => __('Rooms', 'gdlr-hotel'), 'singular_name' => __('Room', 'gdlr-hotel'), 'add_new' => __('Add New', 'gdlr-hotel'), 'add_new_item' => __('Add New Room', 'gdlr-hotel'), 'edit_item' => __('Edit Room', 'gdlr-hotel'), 'new_item' => __('New Room', 'gdlr-hotel'), 'all_items' => __('All Rooms', 'gdlr-hotel'), 'view_item' => __('View Room', 'gdlr-hotel'), 'search_items' => __('Search Room', 'gdlr-hotel'), 'not_found' => __('No rooms found', 'gdlr-hotel'), 'not_found_in_trash' => __('No rooms found in Trash', 'gdlr-hotel'), 'parent_item_colon' => '', 'menu_name' => __('Rooms (Hostel)', 'gdlr-hotel')), 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'show_in_menu' => true, 'query_var' => true, 'rewrite' => array('slug' => $room_slug), 'capability_type' => 'post', 'has_archive' => true, 'hierarchical' => false, 'menu_position' => 8, 'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments', 'custom-fields'))); // create room categories register_taxonomy('hostel_room_category', array("hostel_room"), array('hierarchical' => true, 'show_admin_column' => true, 'label' => __('Room Categories', 'gdlr-hotel'), 'singular_label' => __('Room Category', 'gdlr-hotel'), 'rewrite' => array('slug' => $room_category_slug))); register_taxonomy_for_object_type('hostel_room_category', 'hostel_room'); // create custom taxonomy for room category if (is_admin() && class_exists('gdlr_tax_meta')) { global $gdlr_sidebar_controller; new gdlr_tax_meta(array('taxonomy' => 'hostel_room_category', 'slug' => 'gdlr_hostel_branch'), array('upload' => array('title' => __('Hostel Thumbnail', 'gdlr-song'), 'type' => 'upload'), 'content' => array('title' => __('Hostel Location', 'gdlr-song'), 'type' => 'textarea'))); } // create room tag register_taxonomy('hostel_room_tag', array('hostel_room'), array('hierarchical' => false, 'show_admin_column' => true, 'label' => __('Room Tags', 'gdlr-hotel'), 'singular_label' => __('Room Tag', 'gdlr-hotel'), 'rewrite' => array('slug' => $room_tag_slug))); register_taxonomy_for_object_type('hostel_room_tag', 'hostel_room'); // add filter to style single template add_filter('single_template', 'gdlr_register_hostel_room_template'); }
function register_taxonomies($sitio, $name, $type, $slug) { // return; $labels_cat = array('name' => _x($name, 'Taxonomy General Name', $sitio), 'singular_name' => _x('Categoría', 'Taxonomy Singular Name', $sitio), 'menu_name' => __($name, $sitio), 'all_items' => __('Todas', $sitio), 'parent_item' => __($name . ' padre', $sitio), 'parent_item_colon' => __($name . ' padre:', $sitio), 'new_item_name' => __('Agregar nueva ' . $name, $sitio), 'add_new_item' => __('Agregar nueva', $sitio), 'edit_item' => __('Editar', $sitio), 'update_item' => __('Actualizar', $sitio), 'separate_items_with_commas' => __('Separar ' . $name . ' por comas', $sitio), 'search_items' => __('Buscar ' . $name, $sitio), 'add_or_remove_items' => __('Agregar o borrar ' . $name, $sitio), 'choose_from_most_used' => __('Elegir de las más usuadas', $sitio), 'not_found' => __('No encontrado', $sitio)); $args_cat = array('labels' => $labels_cat, 'hierarchical' => true, 'public' => true, 'show_ui' => true, 'show_admin_column' => true, 'show_in_nav_menus' => true, 'show_tagcloud' => false); register_taxonomy($slug, array($type), $args_cat); }
/** * @ticket 26948 */ public function test_dont_process_terms_if_taxonomy_does_not_allow_show_on_quick_edit() { register_taxonomy('wptests_tax_1', 'post', array('show_in_quick_edit' => false, 'hierarchical' => true)); register_taxonomy('wptests_tax_2', 'post', array('show_in_quick_edit' => true, 'hierarchical' => true)); $t1 = self::factory()->term->create(array('taxonomy' => 'wptests_tax_1')); $t2 = self::factory()->term->create(array('taxonomy' => 'wptests_tax_2')); // Become an administrator. $this->_setRole('administrator'); $post = self::factory()->post->create_and_get(array('post_author' => get_current_user_id())); // Set up a request. $_POST['_inline_edit'] = wp_create_nonce('inlineeditnonce'); $_POST['post_ID'] = $post->ID; $_POST['post_type'] = $post->post_type; $_POST['content'] = $post->post_content; $_POST['excerpt'] = $post->post_excerpt; $_POST['_status'] = $post->post_status; $_POST['post_status'] = $post->post_status; $_POST['screen'] = 'post'; $_POST['post_view'] = 'excerpt'; $_POST['tax_input'] = array('wptests_tax_1' => array($t1), 'wptests_tax_2' => array($t2)); // Make the request. try { $this->_handleAjax('inline-save'); } catch (WPAjaxDieContinueException $e) { unset($e); } // wptests_tax_1 terms should have been refused. $post_terms_1 = wp_get_object_terms($post->ID, 'wptests_tax_1'); $this->assertEmpty($post_terms_1); // wptests_tax_2 terms should have been added successfully. $post_terms_2 = wp_get_object_terms($post->ID, 'wptests_tax_2'); $this->assertEqualSets(array($t2), wp_list_pluck($post_terms_2, 'term_id')); }
/** * Register Custom Taxonomy * * @since 1.0.0 */ public function wpl_toolskit_gallery_taxomomy() { $labels = array('name' => _x($this->wpl_get_name_singular() . ' ' . 'Categories', 'Taxonomy General Name', 'charitylife-toolskit'), 'singular_name' => _x($this->wpl_get_name_singular() . ' ' . 'Category', 'Taxonomy Singular Name', 'charitylife-toolskit'), 'menu_name' => __($this->wpl_get_name_singular() . ' ' . 'Categories', 'charitylife-toolskit'), 'all_items' => __('All Categories', 'charitylife-toolskit'), 'parent_item' => __('Parent Category', 'charitylife-toolskit'), 'parent_item_colon' => __('Parent Category:', 'charitylife-toolskit'), 'new_item_name' => __('New Category Name', 'charitylife-toolskit'), 'add_new_item' => __('Add New Category', 'charitylife-toolskit'), 'edit_item' => __('Edit Category', 'charitylife-toolskit'), 'update_item' => __('Update Category', 'charitylife-toolskit'), 'view_item' => __('View Category', 'charitylife-toolskit'), 'separate_items_with_commas' => __('Separate items with commas', 'charitylife-toolskit'), 'add_or_remove_items' => __('Add or remove items', 'charitylife-toolskit'), 'choose_from_most_used' => __('Choose from the most used', 'charitylife-toolskit'), 'popular_items' => __('Popular Categories', 'charitylife-toolskit'), 'search_items' => __('Search Categories', 'charitylife-toolskit'), 'not_found' => __('Not Found', 'charitylife-toolskit')); $args = array('labels' => $labels, 'hierarchical' => true, 'public' => true, 'show_ui' => true, 'show_admin_column' => true, 'show_in_nav_menus' => true, 'show_tagcloud' => false, 'rewrite' => array('slug' => $this->wpl_get_category_url_rewrite())); register_taxonomy('wpl_gallery_category', array('post_gallery'), $args); flush_rewrite_rules(); }
function film_year_custom_taxonomy() { $labels = array('name' => _x('Years', 'Taxonomy General Name', 'sage'), 'singular_name' => _x('Year', 'Taxonomy Singular Name', 'sage'), 'menu_name' => __('Year', 'sage'), 'all_items' => __('All Years', 'sage'), 'parent_item' => __('Parent Year', 'sage'), 'parent_item_colon' => __('Parent Year:', 'sage'), 'new_item_name' => __('New Year Name', 'sage'), 'add_new_item' => __('Add New Year', 'sage'), 'edit_item' => __('Edit Year', 'sage'), 'update_item' => __('Update Year', 'sage'), 'view_item' => __('View Year', 'sage'), 'separate_items_with_commas' => __('Separate years with commas', 'sage'), 'add_or_remove_items' => __('Add or remove years', 'sage'), 'choose_from_most_used' => __('Choose from the most used', 'sage'), 'popular_items' => __('Popular years', 'sage'), 'search_items' => __('Search years', 'sage'), 'not_found' => __('Not Found', 'sage')); $rewrite = array('slug' => 'year', 'with_front' => true, 'hierarchical' => false); $args = array('labels' => $labels, 'hierarchical' => true, 'public' => true, 'show_ui' => true, 'show_admin_column' => true, 'show_in_nav_menus' => true, 'show_tagcloud' => true, 'rewrite' => $rewrite); register_taxonomy('film-year', array('post', ' film'), $args); }
public function add_tax_groups() { $labels = array('name' => __('Zákony'), 'singular_name' => __('Zákon'), 'add_new' => __('Nový záznam'), 'add_new_item' => __('Přidat nový záznam'), 'edit_item' => __('Upravit'), 'new_item' => __('Nový záznam'), 'view_item' => __('Upravit záznam'), 'search_items' => __('Vyhledat'), 'not_found' => __('Nic nenalezeno'), 'not_found_in_trash' => __('Nic nenalezeno')); $args = array('labels' => $labels, 'public' => true, 'show_ui' => true, 'show_tagcloud' => false, 'query_var' => true, 'hierarchical' => true); register_taxonomy('judikatura-zakony', $this->postType, $args); $this->add_tax_groups_meta_box(); }
function create_portfolio_taxonomies() { // Add new taxonomy, make it hierarchical (like categories) $labels = array('name' => __('Portfolio Categories', 'element'), 'singular_name' => __('Portfolio Category', 'element'), 'search_items' => __('Search Portfolio Categories', 'element'), 'all_items' => __('All Portfolio Categories', 'element'), 'parent_item' => __('Parent Portfolio Category', 'element'), 'parent_item_colon' => __('Parent Portfolio Category:', 'element'), 'edit_item' => __('Edit Portfolio Category', 'element'), 'update_item' => __('Update Portfolio Category', 'element'), 'add_new_item' => __('Add New Portfolio Category', 'element'), 'new_item_name' => __('New Portfolio Category Name', 'element'), 'menu_name' => __('Portfolio Category', 'element')); $args = array('hierarchical' => true, 'labels' => $labels, 'show_ui' => true, 'show_admin_column' => true, 'query_var' => true, 'rewrite' => array('slug' => 'portfolio_category')); register_taxonomy('portfolio_category', array('portfolio'), $args); }
function my_custom_taxonomies() { // Type of Product/Service taxonomy $labels = array('name' => 'Type of Projects', 'singular_name' => 'Type of Project', 'search_items' => 'Search Types of Projects', 'all_items' => 'All Types of Projects', 'parent_item' => 'Parent Type of Project', 'parent_item_colon' => 'Parent Type of Project:', 'edit_item' => 'Edit Type of Project', 'update_item' => 'Update Type of Project', 'add_new_item' => 'Add New Type of Project', 'new_item_name' => 'New Type of Project Name', 'menu_name' => 'Type of Projects'); $args = array('hierarchical' => true, 'labels' => $labels, 'show_ui' => true, 'show_admin_column' => true, 'query_var' => true, 'rewrite' => array('slug' => 'project-type')); register_taxonomy('project-type', array('projects'), $args); }
/** * Custom taxonomy: rental-type */ public function register() { $labels = array('name' => _x('Rental Type', 'Taxonomy General Name', 'VRC'), 'singular_name' => _x('Rental Type', 'Taxonomy Singular Name', 'VRC'), 'menu_name' => __('Types', 'VRC'), 'all_items' => __('All Rental Types', 'VRC'), 'parent_item' => __('Parent Rental Type', 'VRC'), 'parent_item_colon' => __('Parent Rental Type:', 'VRC'), 'new_item_name' => __('New Rental Type Name', 'VRC'), 'add_new_item' => __('Add New Rental Type', 'VRC'), 'edit_item' => __('Edit Rental Type', 'VRC'), 'update_item' => __('Update Rental Type', 'VRC'), 'view_item' => __('View Rental Type', 'VRC'), 'separate_items_with_commas' => __('Separate Rental Types with commas', 'VRC'), 'add_or_remove_items' => __('Add or remove Rental Types', 'VRC'), 'choose_from_most_used' => __('Choose from the most used', 'VRC'), 'popular_items' => __('Popular Rental Types', 'VRC'), 'search_items' => __('Search Rental Types', 'VRC'), 'not_found' => __('Not Found', 'VRC')); $rewrite = array('slug' => 'rental-type', 'with_front' => true, 'hierarchical' => true); $args = array('labels' => $labels, 'hierarchical' => true, 'public' => true, 'show_ui' => true, 'show_admin_column' => true, 'show_in_nav_menus' => true, 'show_tagcloud' => true, 'rewrite' => $rewrite); register_taxonomy('vr_rental-type', array('vr_rental'), $args); }
function cw_custom_taxonomies() { //Hierachicher Taxonomy $labels = array('name' => 'Kategorien', 'singular_name' => 'Kategorie', 'seach_items' => 'Kategorien durchsuchen', 'all_items' => 'Alle Kategorien', 'parent_item' => 'Übergeordnete Kategorie', 'parent_item_colon' => 'Hauptkategorie', 'edit_item' => 'Kategorie bearbeiten', 'update_item' => 'Kategorie aktualisieren', 'add_new_item' => 'Kategorie hinzufügen', 'new_item' => 'Neue Kategorie', 'new_item_name' => 'Neue Kategorie', 'menu_name' => 'Kategorien', 'not_found' => 'Keine Kategorien gefunden', 'add_new' => 'Neu erstellen'); $args = array('hierarchical' => true, 'labels' => $labels, 'show_ui' => true, 'show_admin_column' => true, 'query_var' => true, 'sort' => true, 'rewrite' => array('slug' => 'kategorie')); register_taxonomy('kategorie', array('immobilien'), $args); }
/** * Setup the "slide-page" taxonomy, linked to the "slide" post type. * @since 1.0.0 * @return void */ public function setup_slide_pages_taxonomy() { // "Slide Groups" Custom Taxonomy $labels = array('name' => _x('Slide Groups', 'taxonomy general name', 'wooslider'), 'singular_name' => _x('Slide Group', 'taxonomy singular name', 'wooslider'), 'search_items' => __('Search Slide Groups', 'wooslider'), 'all_items' => __('All Slide Groups', 'wooslider'), 'parent_item' => __('Parent Slide Group', 'wooslider'), 'parent_item_colon' => __('Parent Slide Group:', 'wooslider'), 'edit_item' => __('Edit Slide Group', 'wooslider'), 'update_item' => __('Update Slide Group', 'wooslider'), 'add_new_item' => __('Add New Slide Group', 'wooslider'), 'new_item_name' => __('New Slide Group Name', 'wooslider'), 'menu_name' => __('Slide Groups', 'wooslider'), 'popular_items' => null); $args = array('hierarchical' => true, 'labels' => $labels, 'show_ui' => true, 'query_var' => true, 'rewrite' => array('slug' => 'slide-page')); register_taxonomy('slide-page', array('slide'), $args); }
/** * Add custom taxonomies * * Additional custom taxonomies can be defined here * http://codex.wordpress.org/Function_Reference/register_taxonomy */ function add_custom_taxonomies() { // Add new "Locations" taxonomy to Posts register_taxonomy('p_category', 'portfolio', array( // Hierarchical taxonomy (like categories) 'hierarchical' => true, // This array of options controls the labels displayed in the WordPress Admin UI 'labels' => array( 'name' => _x( 'Portfolio Category', 'taxonomy general name', 'studiofolio' ), 'singular_name' => _x( 'Category', 'taxonomy singular name', 'studiofolio' ), 'search_items' => __( 'Search Category', 'studiofolio' ), 'all_items' => __( 'All Categories', 'studiofolio' ), 'parent_item' => __( 'Parent Category', 'studiofolio' ), 'parent_item_colon' => __( 'Parent Category:', 'studiofolio' ), 'edit_item' => __( 'Edit Category', 'studiofolio' ), 'update_item' => __( 'Update Category', 'studiofolio' ), 'add_new_item' => __( 'Add New Category', 'studiofolio' ), 'new_item_name' => __( 'New Category Name', 'studiofolio' ), 'menu_name' => __( 'Portfolio Categories', 'studiofolio' ), ), // Control the slugs used for this taxonomy 'rewrite' => array( 'slug' => 'portfolio-category', // This controls the base slug that will display before each term 'with_front' => false, // Don't display the category base before "/locations/" 'hierarchical' => true // This will allow URL's like "/locations/boston/cambridge/" ), ) ); };
/** * Register Property Feature Taxonomy * @since 1.0.0 */ public function register_property_feature_taxonomy() { $labels = array('name' => _x('Property Features', 'Taxonomy General Name', 'inspiry-real-estate'), 'singular_name' => _x('Property Feature', 'Taxonomy Singular Name', 'inspiry-real-estate'), 'menu_name' => __('Features', 'inspiry-real-estate'), 'all_items' => __('All Property Features', 'inspiry-real-estate'), 'parent_item' => __('Parent Property Feature', 'inspiry-real-estate'), 'parent_item_colon' => __('Parent Property Feature:', 'inspiry-real-estate'), 'new_item_name' => __('New Property Feature Name', 'inspiry-real-estate'), 'add_new_item' => __('Add New Property Feature', 'inspiry-real-estate'), 'edit_item' => __('Edit Property Feature', 'inspiry-real-estate'), 'update_item' => __('Update Property Feature', 'inspiry-real-estate'), 'view_item' => __('View Property Feature', 'inspiry-real-estate'), 'separate_items_with_commas' => __('Separate Property Features with commas', 'inspiry-real-estate'), 'add_or_remove_items' => __('Add or remove Property Features', 'inspiry-real-estate'), 'choose_from_most_used' => __('Choose from the most used', 'inspiry-real-estate'), 'popular_items' => __('Popular Property Features', 'inspiry-real-estate'), 'search_items' => __('Search Property Features', 'inspiry-real-estate'), 'not_found' => __('Not Found', 'inspiry-real-estate')); $rewrite = array('slug' => apply_filters('inspiry_property_feature_slug', __('property-feature', 'inspiry-real-estate')), 'with_front' => true, 'hierarchical' => true); $args = array('labels' => $labels, 'hierarchical' => true, 'public' => true, 'show_ui' => true, 'show_admin_column' => false, 'show_in_nav_menus' => true, 'show_tagcloud' => true, 'rewrite' => $rewrite); register_taxonomy('property-feature', array('property'), $args); }
function location_taxonomy() { $labels = array('name' => _x('Locations', 'Taxonomy General Name', 'sage'), 'singular_name' => _x('Location', 'Taxonomy Singular Name', 'sage'), 'menu_name' => __('Locations', 'sage'), 'all_items' => __('All Locations', 'sage'), 'parent_item' => __('Parent Location', 'sage'), 'parent_item_colon' => __('Parent Location:', 'sage'), 'new_item_name' => __('New Location Name', 'sage'), 'add_new_item' => __('Add New Location', 'sage'), 'edit_item' => __('Edit Location', 'sage'), 'update_item' => __('Update Location', 'sage'), 'view_item' => __('View Location', 'sage'), 'separate_items_with_commas' => __('Separate Locations with commas', 'sage'), 'add_or_remove_items' => __('Add or remove Locations', 'sage'), 'choose_from_most_used' => __('Choose from the most used', 'sage'), 'popular_items' => __('Popular Locations', 'sage'), 'search_items' => __('Search Locations', 'sage'), 'not_found' => __('Not Found', 'sage'), 'items_list' => __('Locations list', 'sage'), 'items_list_navigation' => __('Locations list navigation', 'sage')); $rewrite = array('slug' => 'location', 'with_front' => true, 'hierarchical' => false); $args = array('labels' => $labels, 'hierarchical' => true, 'public' => true, 'show_ui' => true, 'show_admin_column' => true, 'show_in_nav_menus' => true, 'show_tagcloud' => true, 'rewrite' => $rewrite); register_taxonomy('location', array('post', 'attachment', 'voyage', 'estimate', 'service', 'host', 'partner'), $args); }
function register_taxonomy_room_types() { $labels = array('name' => _x('Room types', 'room_types'), 'singular_name' => _x('Room type', 'room_types'), 'search_items' => _x('Search Room types', 'room_types'), 'all_items' => _x('All Room types', 'room_types'), 'parent_item' => _x('Parent Room type', 'room_types'), 'parent_item_colon' => _x('Parent Room type:', 'room_types'), 'edit_item' => _x('Edit Room type', 'room_types'), 'update_item' => _x('Update Room type', 'room_types'), 'add_new_item' => _x('Add New Room type', 'room_types'), 'new_item_name' => _x('New Room type', 'room_types'), 'add_or_remove_items' => _x('Add or remove Room types', 'room_types'), 'menu_name' => _x('Room types', 'room_types')); $args = array('labels' => $labels, 'public' => true, 'show_in_nav_menus' => false, 'show_ui' => true, 'show_tagcloud' => false, 'show_admin_column' => true, 'hierarchical' => true, 'rewrite' => true, 'query_var' => true); register_taxonomy('room_types', array('room'), $args); flush_rewrite_rules(); }
function custom_post_type_maxcom() { register_post_type('sucursal', array('labels' => array('name' => __('Sucursal', 'bonestheme'), 'singular_name' => __('Sucursal', 'bonestheme'), 'all_items' => __('All sucursals', 'bonestheme'), 'add_new' => __('Add New', 'bonestheme'), 'add_new_item' => __('Add New Sucursal', 'bonestheme'), 'edit' => __('Edit', 'bonestheme'), 'edit_item' => __('Edit Post Types', 'bonestheme'), 'new_item' => __('New Post Type', 'bonestheme'), 'view_item' => __('View Post Type', 'bonestheme'), 'search_items' => __('Search Post Type', 'bonestheme'), 'not_found' => __('Nothing found in the Database.', 'bonestheme'), 'not_found_in_trash' => __('Nothing found in Trash', 'bonestheme'), 'parent_item_colon' => ''), 'description' => __('This is the example sucursal type', 'bonestheme'), 'public' => true, 'publicly_queryable' => true, 'exclude_from_search' => false, 'show_ui' => true, 'query_var' => true, 'menu_position' => 8, 'rewrite' => array('slug' => 'sucursal', 'with_front' => false), 'has_archive' => 'sucursal', 'capability_type' => 'post', 'hierarchical' => false, 'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'revisions'))); /* end of register post type */ register_taxonomy('region', array('sucursal'), array('hierarchical' => true, 'labels' => array('name' => __('Regiónes', 'bonestheme'), 'singular_name' => __('Región', 'bonestheme'), 'search_items' => __('Search Regiónes', 'bonestheme'), 'all_items' => __('All Regiónes', 'bonestheme'), 'parent_item' => __('Parent Región', 'bonestheme'), 'parent_item_colon' => __('Parent Región:', 'bonestheme'), 'edit_item' => __('Edit Región', 'bonestheme'), 'update_item' => __('Update Región', 'bonestheme'), 'add_new_item' => __('Add New Región', 'bonestheme'), 'new_item_name' => __('New Región Name', 'bonestheme')), 'show_admin_column' => true, 'show_ui' => true, 'query_var' => true, 'rewrite' => array('slug' => 'region'))); register_taxonomy('tipo', array('sucursal'), array('hierarchical' => true, 'labels' => array('name' => __('Tipo Sucursales', 'bonestheme'), 'singular_name' => __('Tipo Sucursal', 'bonestheme'), 'search_items' => __('Search Tipo Sucursales', 'bonestheme'), 'all_items' => __('All Tipo Sucursales', 'bonestheme'), 'parent_item' => __('Parent Tipo Sucursal', 'bonestheme'), 'parent_item_colon' => __('Parent Tipo Sucursal:', 'bonestheme'), 'edit_item' => __('Edit Tipo Sucursal', 'bonestheme'), 'update_item' => __('Update Tipo Sucursal', 'bonestheme'), 'add_new_item' => __('Add New Tipo Sucursal', 'bonestheme'), 'new_item_name' => __('New Tipo Sucursal Name', 'bonestheme')), 'show_admin_column' => true, 'show_ui' => true, 'query_var' => true, 'rewrite' => array('slug' => 'tipo'))); }
/** * @ticket 32536 */ public function test_term_factory_create_and_get_should_return_term_object() { register_taxonomy('wptests_tax', 'post'); $term = $this->factory->term->create_and_get(array('taxonomy' => 'wptests_tax')); $this->assertInternalType('object', $term); $this->assertNotEmpty($term->term_id); }