Last active
November 26, 2015 04:56
-
-
Save talentedaamer/a623f5e09a21ce9f7af8 to your computer and use it in GitHub Desktop.
Registering Properties Custom Post type with key "properties" and custom taxonomy with key "property-category"
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
<?php | |
/** | |
* Properties Post Type General Class | |
* @author Aamer | |
* | |
*/ | |
class properties_cpt { | |
function properties_cpt() { | |
add_action( 'init', array( $this, 'create_property_cpt' ) ); | |
} | |
function create_property_cpt() { | |
$labels = array( | |
'name' => 'Properties', | |
'singular_name' => 'Property', | |
'add_new' => 'Add New', | |
'all_items' => 'All Properties', | |
'add_new_item' => 'Add New Property', | |
'edit_item' => 'Edit Property', | |
'new_item' => 'New Property', | |
'view_item' => 'View Property', | |
'search_items'=> 'Search Properties', | |
'not_found'=> 'No Property found', | |
'not_found_in_trash'=> 'No Properties found in trash', | |
'parent_item_colon'=> 'Parent Property:', | |
'menu_name'=>=> 'Properties' | |
); | |
$args = array( | |
'labels'=> $labels, | |
'public'=> true, | |
'exclude_from_search'=> false, | |
'publicly_queryable'=> true, | |
'show_ui'=> true, | |
'show_in_nav_menus'=> true, | |
'show_in_menu'=> true, | |
'show_in_admin_bar'=> true, | |
'menu_position'=> 20, | |
'menu_icon'=> 'dashicons-admin-multisite', | |
'capability_type'=> 'post', | |
'hierarchical'=> true, | |
'supports'=> array('title','editor','thumbnail'), | |
'has_archive'=> true, | |
'query_var'=> true, | |
'can_export'=> true | |
); | |
register_post_type( 'properties', $args ); | |
} | |
} | |
$properties_cpt = new properties_cpt(); |
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
<?php | |
/** | |
* Properties Category taxonomy Class | |
* @author Aamer | |
* | |
*/ | |
class properties_cat { | |
function properties_cat() { | |
add_action( 'init', array( $this,'sperry_property_cat' ) ); | |
} | |
function sperry_property_cat() { | |
$cat_labels = array( | |
'name'=> 'Categories', | |
'singular_name'=> 'Category', | |
'menu_name'=> 'Category', | |
'all_items'=> 'All Items', | |
'parent_item'=> 'Parent Item', | |
'parent_item_colon'=> 'Parent Item:', | |
'new_item_name'=> 'New Item Name', | |
'add_new_item'=> 'Add New Item', | |
'edit_item'=> 'Edit Item', | |
'update_item'=> 'Update Item', | |
'view_item'=> 'View Item', | |
'separate_items_with_commas'=> 'Separate items with commas', | |
'add_or_remove_items'=> 'Add or remove items', | |
'choose_from_most_used'=> 'Choose from the most used', | |
'popular_items'=> 'Popular Items', | |
'search_items'=> 'Search Items', | |
'not_found'=> 'Not Found', | |
'items_list'=> 'Items list', | |
'items_list_navigation'=> 'Items list navigation', | |
); | |
$cat_args = array( | |
'labels'=> $cat_labels, | |
'hierarchical'=> true, | |
'public'=> true, | |
'show_ui'=> true, | |
'show_admin_column'=> true, | |
'show_in_nav_menus'=> true, | |
'show_tagcloud'=> false, | |
); | |
register_taxonomy( 'property-category', array( 'properties' ), $cat_args ); | |
} | |
} | |
$properties_cat = new properties_cat(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment