1: <?php
2: /**
3: * TAXONOMY Business Categories
4: *
5: * @package EPL
6: * @subpackage Taxonomy/BusinessCategories
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_business_listing taxonomy
19: *
20: * @since 1.0
21: * @return void
22: */
23: function epl_register_taxonomy_business_listings() {
24:
25: $slug = defined( 'EPL_BUSINESS_CAT_SLUG' ) ? EPL_BUSINESS_CAT_SLUG : 'business-category';
26: $hierarchical = defined( 'EPL_BUSINESS_CAT_HIERARCHICAL' ) && EPL_BUSINESS_CAT_HIERARCHICAL ? false : true;
27: $rewrite = defined( 'EPL_BUSINESS_CAT_DISABLE_REWRITE' ) && EPL_BUSINESS_CAT_DISABLE_REWRITE ? false : array(
28: 'slug' => $slug,
29: 'with_front' => true,
30: 'hierarchical' => $hierarchical,
31: );
32: $rest = defined( 'EPL_BUSINESS_CAT_DISABLE_REST' ) && EPL_BUSINESS_CAT_DISABLE_REST ? false : true;
33:
34: $labels = array(
35: 'name' => _x( 'Business Categories', 'Taxonomy General Name', 'easy-property-listings' ),
36: 'singular_name' => _x( 'Business Category', 'Taxonomy Singular Name', 'easy-property-listings' ),
37: 'menu_name' => __( 'Categories', 'easy-property-listings' ),
38: 'all_items' => __( 'All Business Categories', 'easy-property-listings' ),
39: 'parent_item' => __( 'Parent Business Category', 'easy-property-listings' ),
40: 'parent_item_colon' => __( 'Parent Business Category:', 'easy-property-listings' ),
41: 'new_item_name' => __( 'New Business Category Name', 'easy-property-listings' ),
42: 'add_new_item' => __( 'Add New Business Category', 'easy-property-listings' ),
43: 'edit_item' => __( 'Edit Business Category', 'easy-property-listings' ),
44: 'update_item' => __( 'Update Business Category', 'easy-property-listings' ),
45: 'separate_items_with_commas' => __( 'Separate Business Category with commas', 'easy-property-listings' ),
46: 'search_items' => __( 'Search Business Category', 'easy-property-listings' ),
47: 'add_or_remove_items' => __( 'Add or remove Business Category', 'easy-property-listings' ),
48: 'choose_from_most_used' => __( 'Choose from the most used Business Category', 'easy-property-listings' ),
49: 'not_found' => __( 'Business Category 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_business_listing', array( 'business' ), $args );
64: }
65: add_action( 'init', 'epl_register_taxonomy_business_listings', 0 );
66: