WordPress Tutorial: How to create custom sections in dashboard

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.

The Problem 🤔

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.

The Solution 🤓

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:

1. Open Your Functions.php File

  • Navigate to your WordPress theme folder via FTP or your hosting provider’s file manager.
  • Locate the functions.php file of your active theme. 👉 Tip: If you’re using a child theme (recommended), edit the functions.php file of the child theme to make your changes update-proof.

2. Add the Custom Code

  • Copy the code snippet provided at the end of this post.
  • Paste it into the functions.php file.

3. Save and Refresh

  • Save the file and refresh your WordPress dashboard.
  • You’ll now see a new section in the left-hand menu labeled „Team Members“ (or whatever name you’ve chosen).

4. Add New Entries

  • Click on the new „Team Members“ menu item.
  • Add individual entries for each team member, complete with:
    • Title: The team member’s name.
    • Content: Their bio or description.
    • Featured Image: Their profile picture.

Additionally: Editing with Elementor 🥸

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:

1. Enable Elementor for "Team Members"

  • Go to Elementor → Settings → General.
  • Under the section Post Types, check the box for „Team Members“.
  • Save your changes.

2. Update Permalinks

  • Navigate to Settings → Permalinks.
  • Click Save Changes to refresh the permalink structure.

The Benefits of Custom Post Types ✅

By creating a Custom Post Type, you gain:

  • Improved Organization: Separate specific content types for easier management.
  • Professional Dashboard: Create a clean and intuitive admin experience for you and your team.
  • Enhanced Flexibility: Customize features like taxonomies, labels, and archive pages to suit your needs.
  • Better SEO: Structure your content clearly, helping search engines index it properly.

Custom Post Type Code Snippet 🧑‍💻

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);

				
			

Conclusion 💡

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.