Locations CPT
if ( ! function_exists('cspace_custom_post_type') ) {
// Register Custom Post Type
function cspace_custom_post_type() {
$labels = array(
'name' => _x( 'Locations', 'Post Type General Name', 'cspace' ),
'singular_name' => _x( 'Location', 'Post Type Singular Name', 'cspace' ),
'menu_name' => __( 'Locations', 'cspace' ),
'name_admin_bar' => __( 'Locations', 'cspace' ),
'archives' => __( 'Location Archives', 'cspace' ),
'attributes' => __( 'Location Attributes', 'cspace' ),
'parent_item_colon' => __( 'Parent Location:', 'cspace' ),
'all_items' => __( 'All Locations', 'cspace' ),
'add_new_item' => __( 'Add New Location', 'cspace' ),
'add_new' => __( 'Add New Location', 'cspace' ),
'new_item' => __( 'New Location', 'cspace' ),
'edit_item' => __( 'Edit Location', 'cspace' ),
'update_item' => __( 'Update Location', 'cspace' ),
'view_item' => __( 'View Location', 'cspace' ),
'view_items' => __( 'View Locations', 'cspace' ),
'search_items' => __( 'Search Location', 'cspace' ),
'not_found' => __( 'Location not found', 'cspace' ),
'not_found_in_trash' => __( 'Location not found in Trash', 'cspace' ),
'featured_image' => __( 'Location Featured Image', 'cspace' ),
'set_featured_image' => __( 'Set location featured image', 'cspace' ),
'remove_featured_image' => __( 'Remove location featured image', 'cspace' ),
'use_featured_image' => __( 'Use as location featured image', 'cspace' ),
'insert_into_item' => __( 'Insert into location', 'cspace' ),
'uploaded_to_this_item' => __( 'Uploaded to this location', 'cspace' ),
'items_list' => __( 'Locations list', 'cspace' ),
'items_list_navigation' => __( 'Locations list navigation', 'cspace' ),
'filter_items_list' => __( 'Filter locations list', 'cspace' ),
);
$args = array(
'label' => __( 'Location', 'cspace' ),
'description' => __( 'Locations Custom Post Type', 'cspace' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'thumbnail', 'revisions', 'custom-fields', 'page-attributes' ),
'taxonomies' => array( 'category', 'post_tag' ),
'hierarchical' => true,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 20,
'menu_icon' => 'dashicons-location',
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page',
);
register_post_type( 'locations', $args );
}
add_action( 'init', 'cspace_custom_post_type', 0 );
}