Managing content in WordPress can become overwhelming, especially when you need to separate specific content types like team members or portfolios from regular posts and pages. This tutorial will guide you step-by-step on how to create a custom section in your WordPress dashboard using a Custom Post Type (CPT). Whether you’re a beginner or a developer, this guide will help you organize your content efficiently.
Imagine you want to create a dedicated section in your WordPress dashboard for team members. You don’t want them mixed with regular posts or cluttering the „Pages“ section. Instead, you need them neatly separated and accessible in their own menu category.
Without a Custom Post Type, managing unique content like team members, testimonials, or portfolios can become messy and unorganized. This is where Custom Post Types come to the rescue.
Here’s how to create a Custom Post Type that adds a clean and independent section to your WordPress dashboard. These entries are independent of posts or pages, creating a cleaner and more organized structure in your dashboard. Follow these simple steps:
If you’re using Elementor, you might notice that the newly created „Team Members“ section cannot be edited with Elementor by default. To enable Elementor for your Custom Post Type, follow these steps:
By creating a Custom Post Type, you gain:
Below is the PHP code you need to add to your functions.php file:
function custom_post_type_team_members() {
$labels = array(
'name' => _x('Team Members', 'Post Type General Name', 'text_domain'),
'singular_name' => _x('Team Member', 'Post Type Singular Name', 'text_domain'),
'menu_name' => __('Team Members', 'text_domain'),
'name_admin_bar' => __('Team Member', 'text_domain'),
'archives' => __('Team Member Archives', 'text_domain'),
'attributes' => __('Team Member Attributes', 'text_domain'),
'parent_item_colon' => __('Parent Team Member:', 'text_domain'),
'all_items' => __('All Team Members', 'text_domain'),
'add_new_item' => __('Add New Team Member', 'text_domain'),
'add_new' => __('Add New', 'text_domain'),
'new_item' => __('New Team Member', 'text_domain'),
'edit_item' => __('Edit Team Member', 'text_domain'),
'update_item' => __('Update Team Member', 'text_domain'),
'view_item' => __('View Team Member', 'text_domain'),
'view_items' => __('View Team Members', 'text_domain'),
'search_items' => __('Search Team Member', 'text_domain'),
);
$args = array(
'label' => __('Team Member', 'text_domain'),
'description' => __('Custom Post Type for Team Members', 'text_domain'),
'labels' => $labels,
'supports' => array('title', 'editor', 'thumbnail'),
'taxonomies' => array('category'),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'menu_icon' => 'dashicons-groups',
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => true,
'rewrite' => array(
'slug' => 'team-members',
'with_front' => true,
),
'exclude_from_search' => false,
'capability_type' => 'post',
);
register_post_type('team_members', $args);
}
add_action('init', 'custom_post_type_team_members', 0);
Creating a Custom Post Type in WordPress is a straightforward way to improve your site’s content management. Whether it’s for team members, portfolios, or testimonials, Custom Post Types help you maintain a cleaner and more professional dashboard.
Follow the steps outlined in this tutorial and implement the provided code to create your own custom sections in WordPress. If you’re using Elementor, be sure to enable it for your Custom Post Type and refresh your permalinks for a seamless experience.