Locations Post Type – Snapbox
Snapbox Locations custom post type to organize facilities into with ACF, SEO content and various other data elements
if ( ! function_exists('locations_post_type') ) { // Register Custom Post Type function locations_post_type() { $labels = array( 'name' => _x( 'Locations', 'Post Type General Name', 'snapbox-domain' ), 'singular_name' => _x( 'Location', 'Post Type Singular Name', 'snapbox-domain' ), 'menu_name' => __( 'Locations', 'snapbox-domain' ), 'name_admin_bar' => __( 'Location', 'snapbox-domain' ), 'archives' => __( 'Location Archives', 'snapbox-domain' ), 'attributes' => __( 'Location Attributes', 'snapbox-domain' ), 'parent_item_colon' => __( 'Parent Item:', 'snapbox-domain' ), 'all_items' => __( 'All Locations', 'snapbox-domain' ), 'add_new_item' => __( 'Add New Location', 'snapbox-domain' ), 'add_new' => __( 'Add New', 'snapbox-domain' ), 'new_item' => __( 'New Location', 'snapbox-domain' ), 'edit_item' => __( 'Edit Location', 'snapbox-domain' ), 'update_item' => __( 'Update Location', 'snapbox-domain' ), 'view_item' => __( 'View Location', 'snapbox-domain' ), 'view_items' => __( 'View Locations', 'snapbox-domain' ), 'search_items' => __( 'Search Location', 'snapbox-domain' ), 'not_found' => __( 'Not found', 'snapbox-domain' ), 'not_found_in_trash' => __( 'Not found in Trash', 'snapbox-domain' ), 'featured_image' => __( 'Featured Image', 'snapbox-domain' ), 'set_featured_image' => __( 'Set featured image', 'snapbox-domain' ), 'remove_featured_image' => __( 'Remove featured image', 'snapbox-domain' ), 'use_featured_image' => __( 'Use as featured image', 'snapbox-domain' ), 'insert_into_item' => __( 'Insert into Location', 'snapbox-domain' ), 'uploaded_to_this_item' => __( 'Uploaded to this Location', 'snapbox-domain' ), 'items_list' => __( 'Locations list', 'snapbox-domain' ), 'items_list_navigation' => __( 'Locations list navigation', 'snapbox-domain' ), 'filter_items_list' => __( 'Filter locations list', 'snapbox-domain' ), ); $rewrite = array( 'slug' => 'locations', 'with_front' => true, 'pages' => true, 'feeds' => true, ); $args = array( 'label' => __( 'Location', 'snapbox-domain' ), 'description' => __( 'The post type that organize Snapbox facilities', 'snapbox-domain' ), 'labels' => $labels, 'supports' => array( 'title', 'editor', 'custom-fields' ), 'taxonomies' => array( 'category', 'post_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' => true, 'exclude_from_search' => false, 'publicly_queryable' => true, 'rewrite' => $rewrite, 'capability_type' => 'page', ); register_post_type( 'locations', $args ); } add_action( 'init', 'locations_post_type', 0 ); }