Modular Find An Agent
if ( ! function_exists('find_an_agent') ) {
// Register Custom Post Type
function find_an_agent() {
$labels = array(
'name' => _x( 'Agents', 'Post Type General Name', 'o2dcaframework' ),
'singular_name' => _x( 'Agent', 'Post Type Singular Name', 'o2dcaframework' ),
'menu_name' => __( 'Agents', 'o2dcaframework' ),
'name_admin_bar' => __( 'Agent', 'o2dcaframework' ),
'archives' => __( 'Agent Archives', 'o2dcaframework' ),
'attributes' => __( 'Agent Attributes', 'o2dcaframework' ),
'parent_item_colon' => __( 'Parent Agent:', 'o2dcaframework' ),
'all_items' => __( 'All Agents', 'o2dcaframework' ),
'add_new_item' => __( 'Add New Agent', 'o2dcaframework' ),
'add_new' => __( 'Add New', 'o2dcaframework' ),
'new_item' => __( 'New Agent', 'o2dcaframework' ),
'edit_item' => __( 'Edit Agent', 'o2dcaframework' ),
'update_item' => __( 'Update Agent', 'o2dcaframework' ),
'view_item' => __( 'View Agent', 'o2dcaframework' ),
'view_items' => __( 'View Agents', 'o2dcaframework' ),
'search_items' => __( 'Search Agent', 'o2dcaframework' ),
'not_found' => __( 'Not found', 'o2dcaframework' ),
'not_found_in_trash' => __( 'Not found in Trash', 'o2dcaframework' ),
'featured_image' => __( 'Featured Image', 'o2dcaframework' ),
'set_featured_image' => __( 'Set featured image', 'o2dcaframework' ),
'remove_featured_image' => __( 'Remove featured image', 'o2dcaframework' ),
'use_featured_image' => __( 'Use as featured image', 'o2dcaframework' ),
'insert_into_item' => __( 'Insert into agent', 'o2dcaframework' ),
'uploaded_to_this_item' => __( 'Uploaded to this agent', 'o2dcaframework' ),
'items_list' => __( 'Agents list', 'o2dcaframework' ),
'items_list_navigation' => __( 'Agents list navigation', 'o2dcaframework' ),
'filter_items_list' => __( 'Filter agents list', 'o2dcaframework' ),
);
$args = array(
'label' => __( 'Agent', 'o2dcaframework' ),
'description' => __( 'Directory of agents', 'o2dcaframework' ),
'labels' => $labels,
'supports' => array( 'title' ),
'taxonomies' => array( 'agent-territory', 'agent-country', 'agent-state' ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 20,
'menu_icon' => 'dashicons-universal-access',
'show_in_admin_bar' => true,
'show_in_nav_menus' => false,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => true,
'publicly_queryable' => true,
'capability_type' => 'page',
);
register_post_type( 'agents', $args );
}
add_action( 'init', 'find_an_agent', 0 );
}