| 1: | <?php |
| 2: | |
| 3: | |
| 4: | |
| 5: | |
| 6: | |
| 7: | |
| 8: | |
| 9: | |
| 10: | |
| 11: | |
| 12: | |
| 13: | if ( ! defined( 'ABSPATH' ) ) { |
| 14: | exit; |
| 15: | } |
| 16: | |
| 17: | |
| 18: | |
| 19: | |
| 20: | |
| 21: | |
| 22: | |
| 23: | function epl_register_taxonomy_location() { |
| 24: | $location_label = epl_tax_location_label(); |
| 25: | $location_slug = sanitize_title( $location_label ); |
| 26: | $hierarchical = defined( 'EPL_LOCATION_HIERARCHICAL' ) && EPL_LOCATION_HIERARCHICAL ? true : false; |
| 27: | $rest = defined( 'EPL_LOCATION_DISABLE_REST' ) && EPL_LOCATION_DISABLE_REST ? false : true; |
| 28: | |
| 29: | |
| 30: | $labels = array( |
| 31: | 'name' => $location_label, |
| 32: | 'singular_name' => $location_label, |
| 33: | 'menu_name' => $location_label, |
| 34: | 'all_items' => sprintf( __( 'All %s', 'easy-property-listings' ), $location_label ), |
| 35: | 'parent_item' => sprintf( __( 'Parent %s', 'easy-property-listings' ), $location_label ), |
| 36: | 'parent_item_colon' => sprintf( __( 'Parent %s :', 'easy-property-listings' ), $location_label ), |
| 37: | 'new_item_name' => sprintf( __( 'New %s Name', 'easy-property-listings' ), $location_label ), |
| 38: | 'add_new_item' => sprintf( __( 'Add New %s', 'easy-property-listings' ), $location_label ), |
| 39: | 'edit_item' => sprintf( __( 'Edit %s', 'easy-property-listings' ), $location_label ), |
| 40: | 'update_item' => sprintf( __( 'Update %s', 'easy-property-listings' ), $location_label ), |
| 41: | 'separate_items_with_commas' => sprintf( __( 'Separate %s with commas', 'easy-property-listings' ), $location_label ), |
| 42: | 'search_items' => sprintf( __( 'Search %s', 'easy-property-listings' ), $location_label ), |
| 43: | 'add_or_remove_items' => sprintf( __( 'Add or remove %s', 'easy-property-listings' ), $location_label ), |
| 44: | 'choose_from_most_used' => sprintf( __( 'Choose from the most used %s', 'easy-property-listings' ), $location_label ), |
| 45: | 'not_found' => sprintf( __( '%s Not Found', 'easy-property-listings' ), $location_label ), |
| 46: | ); |
| 47: | $rewrite = array( |
| 48: | 'slug' => $location_slug, |
| 49: | 'with_front' => true, |
| 50: | 'hierarchical' => $hierarchical, |
| 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( 'location', array( 'property', 'rental', 'land', 'rural', 'business', 'commercial', 'commercial_land', 'testimonial', 'location' ), $args ); |
| 64: | } |
| 65: | add_action( 'init', 'epl_register_taxonomy_location', 0 ); |
| 66: | |