0
X
Add Snippet To Project
New Project
Add To Existing Project
/**
* Registers a custom post type 'lsg_awards_post_type'.
*
* @since 1.0.0
*
* @return void
*/
function lsg_register_custom_post_type() : void {
$labels = [
'name' => _x( 'LSG Awards', 'Post Type General Name', 'lsg' ),
'singular_name' => _x( 'LSG Award', 'Post Type Singular Name', 'lsg' ),
'menu_name' => __( 'LSG Awards', 'lsg' ),
'name_admin_bar' => __( 'LSG Awards', 'lsg' ),
'archives' => __( 'LSG Awards Archives', 'lsg' ),
'attributes' => __( 'LSG Awards Attributes', 'lsg' ),
'parent_item_colon' => __( 'Parent LSG Award:', 'lsg' ),
'all_items' => __( 'All LSG Awards', 'lsg' ),
'add_new_item' => __( 'Add New LSG Award', 'lsg' ),
'add_new' => __( 'Add New', 'lsg' ),
'new_item' => __( 'New LSG Award', 'lsg' ),
'edit_item' => __( 'Edit LSG Award', 'lsg' ),
'update_item' => __( 'Update LSG Award', 'lsg' ),
'view_item' => __( 'View LSG Award', 'lsg' ),
'view_items' => __( 'View LSG Awards', 'lsg' ),
'search_items' => __( 'Search LSG Awards', 'lsg' ),
'not_found' => __( 'LSG Award Not Found', 'lsg' ),
'not_found_in_trash' => __( 'LSG Award Not Found in Trash', 'lsg' ),
'featured_image' => __( 'Featured Image', 'lsg' ),
'set_featured_image' => __( 'Set Featured Image', 'lsg' ),
'remove_featured_image' => __( 'Remove Featured Image', 'lsg' ),
'use_featured_image' => __( 'Use as Featured Image', 'lsg' ),
'insert_into_item' => __( 'Insert into LSG Award', 'lsg' ),
'uploaded_to_this_item' => __( 'Uploaded to this LSG Award', 'lsg' ),
'items_list' => __( 'LSG Awards List', 'lsg' ),
'items_list_navigation' => __( 'LSG Awards List Navigation', 'lsg' ),
'filter_items_list' => __( 'Filter LSG Awards List', 'lsg' ),
];
$labels = apply_filters( 'lsg_awards_post_type-labels', $labels );
$args = [
'label' => __( 'LSG Award', 'lsg' ),
'description' => __( 'LSG Milestone Awards', 'lsg' ),
'labels' => $labels,
'supports' => [
'title',
'editor',
'excerpt',
'author',
'thumbnail',
'comments',
'trackbacks',
'revisions',
'custom-fields',
'page-attributes',
'post-formats',
],
'hierarchical' => true,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'menu_icon' => 'dashicons-awards',
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'exclude_from_search' => false,
'has_archive' => true,
'can_export' => false,
'rewrite' => [
'slug' => 'milestone-awards',
'with_front' => true,
'pages' => true,
'feeds' => true,
],
'capability_type' => 'post',
'show_in_rest' => true,
];
$args = apply_filters( 'lsg_awards_post_type-args', $args );
register_post_type( 'lsg_awards_post_type', $args );
}
add_action( 'init', 'lsg_register_custom_post_type', 0 );