This repository has been archived by the owner on Jan 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from xwp/feature/27-add_custom_taxonomies
Add Activity and Location taxonomies.
- Loading branch information
Showing
2 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
<?php | ||
/** | ||
* Class for Travel taxonomies. | ||
* | ||
* @package WPAMPTheme | ||
*/ | ||
|
||
/** | ||
* Class Travel_Taxonomies | ||
* | ||
* @package WPAMPTheme | ||
*/ | ||
class AMP_Travel_Taxonomies { | ||
|
||
/** | ||
* Init AMP_Travel_Taxonomies. | ||
*/ | ||
public function init() { | ||
add_action( 'init', array( $this, 'register_taxonomies' ) ); | ||
} | ||
|
||
/** | ||
* Register 'activity' and 'location' taxonomy. | ||
*/ | ||
public function register_taxonomies() { | ||
register_taxonomy( 'activity', array( 'adventure', 'post' ), array( | ||
'hierarchical' => false, | ||
'query_var' => 'activity', | ||
'public' => true, | ||
'show_ui' => true, | ||
'show_admin_column' => true, | ||
'show_in_rest' => true, | ||
'rest_base' => 'activities', | ||
'rest_controller_class' => 'WP_REST_Terms_Controller', | ||
'labels' => array( | ||
'name' => __( 'Activities', 'travel' ), | ||
'singular_name' => __( 'Activity', 'travel' ), | ||
'search_items' => __( 'Search Activities', 'travel' ), | ||
'popular_items' => __( 'Popular Activities', 'travel' ), | ||
'all_items' => __( 'All Activities', 'travel' ), | ||
'edit_item' => __( 'Edit Activity', 'travel' ), | ||
'view_item' => __( 'View Activity', 'travel' ), | ||
'update_item' => __( 'Update Activity', 'travel' ), | ||
'add_new_item' => __( 'Add New Activity', 'travel' ), | ||
'new_item_name' => __( 'New Activity Name', 'travel' ), | ||
'separate_items_with_commas' => __( 'Separate activities with commas', 'travel' ), | ||
'add_or_remove_items' => __( 'Add or remove activities', 'travel' ), | ||
'choose_from_most_used' => __( 'Choose from the most used activities', 'travel' ), | ||
'not_found' => __( 'No activities found.', 'travel' ), | ||
'no_terms' => __( 'No activities', 'travel' ), | ||
'items_list_navigation' => __( 'Activities list navigation', 'travel' ), | ||
'items_list' => __( 'Activities list', 'travel' ), | ||
'most_used' => __( 'Most Used', 'travel' ), | ||
'back_to_items' => __( '← Back to Activities', 'travel' ), | ||
), | ||
) ); | ||
|
||
register_taxonomy( 'location', array( 'adventure', 'post' ), array( | ||
'hierarchical' => false, | ||
'query_var' => 'location', | ||
'public' => true, | ||
'show_ui' => true, | ||
'show_admin_column' => true, | ||
'show_in_rest' => true, | ||
'rest_base' => 'locations', | ||
'rest_controller_class' => 'WP_REST_Terms_Controller', | ||
'labels' => array( | ||
'name' => __( 'Locations', 'travel' ), | ||
'singular_name' => __( 'Location', 'travel' ), | ||
'search_items' => __( 'Search Locations', 'travel' ), | ||
'popular_items' => __( 'Popular Locations', 'travel' ), | ||
'all_items' => __( 'All Locations', 'travel' ), | ||
'edit_item' => __( 'Edit Location', 'travel' ), | ||
'view_item' => __( 'View Location', 'travel' ), | ||
'update_item' => __( 'Update Location', 'travel' ), | ||
'add_new_item' => __( 'Add New Location', 'travel' ), | ||
'new_item_name' => __( 'New Location Name', 'travel' ), | ||
'separate_items_with_commas' => __( 'Separate locations with commas', 'travel' ), | ||
'add_or_remove_items' => __( 'Add or remove locations', 'travel' ), | ||
'choose_from_most_used' => __( 'Choose from the most used locations', 'travel' ), | ||
'not_found' => __( 'No locations found.', 'travel' ), | ||
'no_terms' => __( 'No locations', 'travel' ), | ||
'items_list_navigation' => __( 'Locations list navigation', 'travel' ), | ||
'items_list' => __( 'Locations list', 'travel' ), | ||
'most_used' => __( 'Most Used', 'travel' ), | ||
'back_to_items' => __( '← Back to Locations', 'travel' ), | ||
), | ||
) ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters