Locations
if ( ! function_exists('location') ) {
// Register Custom Post Type
function location() {
$labels = array(
'name' => _x( 'Locations', 'Post Type General Name', 'location' ),
'singular_name' => _x( 'Location', 'Post Type Singular Name', 'location' ),
'menu_name' => __( 'Locations', 'location' ),
'name_admin_bar' => __( 'Location', 'location' ),
'archives' => __( 'Location Archives', 'location' ),
'attributes' => __( 'Location Attributes', 'location' ),
'parent_item_colon' => __( 'Parent Location:', 'location' ),
'all_items' => __( 'All Locations', 'location' ),
'add_new_item' => __( 'Add New Location', 'location' ),
'add_new' => __( 'Add New Location', 'location' ),
'new_item' => __( 'New Location', 'location' ),
'edit_item' => __( 'Edit Location', 'location' ),
'update_item' => __( 'Update Location', 'location' ),
'view_item' => __( 'View Location', 'location' ),
'view_items' => __( 'View Location', 'location' ),
'search_items' => __( 'Search Location', 'location' ),
'not_found' => __( 'Not found', 'location' ),
'not_found_in_trash' => __( 'Not found in Trash', 'location' ),
'featured_image' => __( 'Location Image', 'location' ),
'set_featured_image' => __( 'Set location image', 'location' ),
'remove_featured_image' => __( 'Remove location image', 'location' ),
'use_featured_image' => __( 'Use as location image', 'location' ),
'insert_into_item' => __( 'Insert into location', 'location' ),
'uploaded_to_this_item' => __( 'Uploaded to this location', 'location' ),
'items_list' => __( 'Locations list', 'location' ),
'items_list_navigation' => __( 'Locations list navigation', 'location' ),
'filter_items_list' => __( 'Filter locations list', 'location' ),
);
$rewrite = array(
'slug' => 'location',
'with_front' => false,
'pages' => true,
'feeds' => false,
);
$capabilities = array(
'edit_post' => 'edit_location',
'read_post' => 'read_location',
'delete_post' => 'delete_location',
'edit_posts' => 'edit_locations',
'edit_others_posts' => 'edit_others_locations',
'publish_posts' => 'publish_locations',
'read_private_posts' => 'read_private_locations',
);
$args = array(
'label' => __( 'Location', 'location' ),
'description' => __( 'Location Description', 'location' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'thumbnail', 'revisions', 'custom-fields', 'post-formats' ),
'taxonomies' => array( 'category', 'location_tag' ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => false,
'exclude_from_search' => false,
'publicly_queryable' => true,
'rewrite' => $rewrite,
'capabilities' => $capabilities,
'show_in_rest' => true,
);
register_post_type( 'location', $args );
}
add_action( 'init', 'location', 0 );
}