Services
// Register Custom Post Type
function Services() {
$labels = array(
'name' => _x( 'Services', 'Post Type General Name', 'hrdradiator' ),
'singular_name' => _x( 'Services', 'Post Type Singular Name', 'hrdradiator' ),
'menu_name' => __( 'Services', 'hrdradiator' ),
'name_admin_bar' => __( 'Services', 'hrdradiator' ),
'archives' => __( 'Service', 'hrdradiator' ),
'attributes' => __( 'Service', 'hrdradiator' ),
'parent_item_colon' => __( 'Parent Service', 'hrdradiator' ),
'all_items' => __( 'All Services', 'hrdradiator' ),
'add_new_item' => __( 'Add New Service', 'hrdradiator' ),
'add_new' => __( 'Add New Service', 'hrdradiator' ),
'new_item' => __( 'New Services', 'hrdradiator' ),
'edit_item' => __( 'Edit Service', 'hrdradiator' ),
'update_item' => __( 'Update Service', 'hrdradiator' ),
'view_item' => __( 'View Service', 'hrdradiator' ),
'view_items' => __( 'View Service', 'hrdradiator' ),
'search_items' => __( 'Search Service', 'hrdradiator' ),
'not_found' => __( 'Service Not found', 'hrdradiator' ),
'not_found_in_trash' => __( 'Service Not found in Trash', 'hrdradiator' ),
'featured_image' => __( 'Service Image', 'hrdradiator' ),
'set_featured_image' => __( 'Set Service image', 'hrdradiator' ),
'remove_featured_image' => __( 'Remove Service image', 'hrdradiator' ),
'use_featured_image' => __( 'Use as Service image', 'hrdradiator' ),
'insert_into_item' => __( 'Insert into Service', 'hrdradiator' ),
'uploaded_to_this_item' => __( 'Uploaded to this Service', 'hrdradiator' ),
'items_list' => __( 'Service list', 'hrdradiator' ),
'items_list_navigation' => __( 'Service list navigation', 'hrdradiator' ),
'filter_items_list' => __( 'Filter Service list', 'hrdradiator' ),
);
$rewrite = array(
'slug' => 'post_type',
'with_front' => true,
'pages' => false,
'feeds' => true,
);
$capabilities = array(
'edit_post' => 'edit_post',
'read_post' => 'read_post',
'delete_post' => 'delete_post',
'edit_posts' => 'edit_posts',
'edit_others_posts' => 'edit_others_posts',
'publish_posts' => 'publish_posts',
'read_private_posts' => 'read_private_posts',
);
$args = array(
'label' => __( 'Services', 'hrdradiator' ),
'description' => __( 'Our Services', 'hrdradiator' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'thumbnail', 'revisions', 'page-attributes' ),
'taxonomies' => array( 'services' ),
'hierarchical' => true,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 70,
'menu_icon' => 'dashicons-art',
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => 'our-services',
'exclude_from_search' => false,
'publicly_queryable' => true,
'query_var' => 'post_type',
'rewrite' => $rewrite,
'capabilities' => $capabilities,
'show_in_rest' => true,
'rest_base' => 'services',
'rest_controller_class' => 'WP_REST_Services_Controller',
);
register_post_type( 'services', $args );
}
add_action( 'init', 'Services', 0 );