1: <?php
2: /**
3: * TAXONOMY :: Features
4: *
5: * @package EPL
6: * @subpackage Taxonomy/Features
7: * @copyright Copyright (c) 2019, Merv Barrett
8: * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9: * @since 1.0
10: */
11:
12: // Exit if accessed directly.
13: if ( ! defined( 'ABSPATH' ) ) {
14: exit;
15: }
16:
17: /**
18: * Registers and sets up the tax_feature taxonomy
19: *
20: * @since 1.0
21: * @return void
22: */
23: function epl_register_taxonomy_features() {
24:
25: $slug = defined( 'EPL_FEATURES_SLUG' ) ? EPL_FEATURES_SLUG : 'feature';
26: $hierarchical = defined( 'EPL_FEATURES_HIERARCHICAL' ) && EPL_FEATURES_HIERARCHICAL ? true : false;
27: $rewrite = defined( 'EPL_FEATURES_DISABLE_REWRITE' ) && EPL_FEATURES_REWRITE ? false : array(
28: 'slug' => $slug,
29: 'with_front' => true,
30: 'hierarchical' => $hierarchical,
31: );
32: $rest = defined( 'EPL_FEATURES_DISABLE_REST' ) && EPL_FEATURES_ENABLE_REST ? false : true;
33:
34: $labels = array(
35: 'name' => _x( 'Features', 'Taxonomy General Name', 'easy-property-listings' ),
36: 'singular_name' => _x( 'Feature', 'Taxonomy Singular Name', 'easy-property-listings' ),
37: 'menu_name' => __( 'Features', 'easy-property-listings' ),
38: 'all_items' => __( 'All Features', 'easy-property-listings' ),
39: 'parent_item' => __( 'Parent Feature', 'easy-property-listings' ),
40: 'parent_item_colon' => __( 'Parent Feature:', 'easy-property-listings' ),
41: 'new_item_name' => __( 'New Feature Name', 'easy-property-listings' ),
42: 'add_new_item' => __( 'Add New Feature', 'easy-property-listings' ),
43: 'edit_item' => __( 'Edit Feature', 'easy-property-listings' ),
44: 'update_item' => __( 'Update Feature', 'easy-property-listings' ),
45: 'separate_items_with_commas' => __( 'Separate Feature with commas', 'easy-property-listings' ),
46: 'search_items' => __( 'Search Feature', 'easy-property-listings' ),
47: 'add_or_remove_items' => __( 'Add or remove Feature', 'easy-property-listings' ),
48: 'choose_from_most_used' => __( 'Choose from the most used Feature', 'easy-property-listings' ),
49: 'not_found' => __( 'Feature Not Found', 'easy-property-listings' ),
50: );
51:
52: $args = array(
53: 'labels' => $labels,
54: 'hierarchical' => $hierarchical,
55: 'public' => true,
56: 'show_ui' => true,
57: 'show_admin_column' => true,
58: 'show_in_nav_menus' => true,
59: 'show_tagcloud' => true,
60: 'show_in_rest' => $rest,
61: 'rewrite' => $rewrite,
62: );
63: register_taxonomy( 'tax_feature', array( 'property', 'rental', 'land', 'rural', 'business', 'commercial', 'commercial_land' ), $args );
64: }
65: add_action( 'init', 'epl_register_taxonomy_features', 0 );
66: