Categories
Elementor

A Practical Guide to Custom Post Types WordPress with Elementor

If you're using WordPress for anything more than a simple blog, you'll quickly run into a classic organizational problem. By default, WordPress gives you two main ways to organize your content: Posts and Pages. That’s it.

Posts are for your blog, and Pages are for static content like your "About" or "Contact" page. This works fine for a basic setup. But what if you're a real estate agent trying to list properties? Or a photographer showcasing a portfolio? Shoving everything into Posts or Pages quickly becomes a chaotic mess.

What Are Custom Post Types and Why Do They Matter?

This is exactly where Custom Post Types (CPTs) save the day. Think of them as creating new, dedicated sections in your WordPress dashboard. Instead of just "Posts" and "Pages," you could have "Properties," "Portfolio Projects," or "Events."

Each CPT gets its own spot in the admin menu, completely separate from your blog. This isn't just about being tidy; it fundamentally changes how you can use WordPress.

Moving Beyond a Simple Blog

By creating these dedicated content types, you transform WordPress from a blogging platform into a true Content Management System (CMS). This is the secret sauce that allows developers to build incredibly complex and organized websites.

This powerful feature was first introduced way back in WordPress 3.0 and has been a cornerstone of modern development ever since. It’s no exaggeration to say that CPTs are a major reason why WordPress now powers over 43% of all websites.

In fact, some of the biggest plugins you probably already use are built on this concept. WooCommerce, for example, uses a product CPT to manage millions of online stores. For a deeper dive into the platform's growth, kinsta.com offers some great insights.

The Real-World Advantage

Let’s go back to that photographer's portfolio. Without a CPT, you might just create a new Page for each project. At first, this seems fine, but you'll hit a wall fast.

  • No Central Archive: How do you automatically create one main "Portfolio" page that lists all your projects? You can't, not easily.
  • Inconsistent Data: You have to remember to manually add the client's name, the date of the shoot, and the camera used on every single page. It's a recipe for typos and forgotten details.
  • Impossible to Filter: What if a visitor wants to see only your "Wedding" photos or sort by "Portrait"? With Pages, it's a non-starter.

A "Portfolio" CPT fixes all of this. It gives you a dedicated section in the admin menu, creates a neat archive page at a URL like yoursite.com/portfolio, and lets you add custom fields for all that structured data (client name, date, etc.).

If you're just starting out, a plugin like Custom Post Type UI makes this whole process incredibly simple, no code required.

Here’s a peek at what that looks like inside the CPT UI plugin—it’s just a simple form.

As you can see, you just fill in the blanks. The plugin handles all the code behind the scenes, making this powerful feature accessible to anyone, regardless of their technical skill.

Creating a Custom Post Type with a Plugin

Let's be real—diving into your functions.php file isn't for everyone. If you're building sites with Elementor, you probably want a faster, more visual way to get things done. Thankfully, you can create custom post types without touching a single line of code.

For this, we'll turn to a community favorite: Custom Post Type UI (CPT UI). With over one million active installations, it's the go-to plugin for a reason. It's simple, reliable, and just plain works.

Let's walk through a common scenario. Imagine you're building a website for a design agency and need a proper "Portfolio" section to showcase their work. Using CPT UI, we can knock this out in just a few minutes.

Installing and Navigating CPT UI

First things first, you need to get the plugin on your site. Just head to your WordPress dashboard, search for "Custom Post Type UI" in the plugin repository, and hit install, then activate. If you need a quick refresher, we have a simple guide on how to install a WordPress plugin.

Once it's active, you'll spot a new CPT UI menu item in your admin sidebar. This is your new command center for creating and managing all your custom content structures.

It’s all about bringing order to what could otherwise become a messy pile of unstructured content.

Diagram illustrating the Custom Post Type process: blog content, unstructured data, and CPT.

This process neatly transforms a potentially jumbled blog into a highly organized system built on dedicated post types.

Setting Up Your First Post Type

Ready to build? Navigate to CPT UI > Add/Edit Post Types. You'll be greeted by a form with a lot of options. Don't get overwhelmed! For our "Portfolio," we only need to worry about a few key settings to get started.

1. The Essentials: Slug & Labels

The first three fields are the most critical:

  • Post Type Slug: This is the URL-friendly name. For our portfolio, let's use portfolio. It has to be lowercase with no spaces. This little slug defines your URLs, like yoursite.com/portfolio/awesome-project.
  • Plural Label: This is what shows up in the admin menu. Portfolios makes perfect sense.
  • Singular Label: This is for single entries, so we'll use Portfolio.

Fill those in, and then look for the "Populate additional labels based on chosen labels" link. Click it. This little timesaver automatically fills out the rest of the label fields for you.

Pro Tip: A clean, descriptive slug is a gift to your future SEO efforts. A slug like portfolio is worlds better than cpt1 or our-agency-projects. Keep it simple and relevant.

2. Core Behavior Settings

Now, scroll down to the "Settings" section. This is where you tell WordPress how this new content type should behave. For our Portfolio, here's what I recommend:

  • Publicly Queryable: Keep this set to True. You want people to actually see your portfolio items on the front end, right? This makes that possible.
  • Has Archive: Definitely set this to True. This automatically creates an archive page at yoursite.com/portfolio that will list all your portfolio entries. Super useful.
  • Hierarchical: We'll set this to False. This makes our Portfolio CPT act like blog posts—standalone entries—rather than Pages, which can have parent/child relationships.
  • Menu Icon: This is a nice touch. You can pick a Dashicon to give your CPT a unique icon in the admin menu. The dashicons-portfolio icon is a perfect fit here.

3. Supported Features

Last stop. In the "Supports" section, check the boxes for the WordPress features you want your Portfolio to have. For a typical portfolio, you'll absolutely want:

  • Title (for the project name)
  • Editor (the main content area for project details)
  • Featured Image (for the main project graphic)
  • Excerpt (a short summary for archive pages)
  • Custom Fields (this one is crucial for adding structured data later on)

Once you've got those configured, hit the "Add Post Type" button at the bottom. And just like that, a new "Portfolios" menu appears in your WordPress dashboard, ready to go.

Adding Custom Taxonomies to Stay Organized

A portfolio without categories is just a big, unsorted list. We need a way to filter projects, and that's where custom taxonomies shine. Let's create one called "Service Type" so we can categorize projects by things like "Web Design," "Branding," or "SEO."

Head over to CPT UI > Add/Edit Taxonomies. The process feels very familiar.

  1. Enter the Taxonomy Slug (e.g., service-type).
  2. Add the Plural Label (Service Types) and Singular Label (Service Type).
  3. Here's the key step: attach it to our Portfolio post type by checking the box next to Portfolio.
  4. Set Hierarchical to True. This makes it behave like Categories (with parent/child options), which is perfect for organizing services.

Click "Add Taxonomy." Now, when you go to add a new Portfolio item, you'll see a "Service Types" box on the side, just like the categories box for your blog posts. This simple step makes your content infinitely more flexible and is the foundation for building powerful filtering systems with Elementor.

Plugins like CPT UI are fantastic for getting up and running quickly, but sometimes you just need more control. If you're a developer or someone who obsesses over performance, registering your CPTs manually with code is the way to go.

This approach cuts out any potential plugin bloat and bakes your content structure right into your site's foundation. Plus, it means your CPTs aren't dependent on a third-party plugin. If a plugin gets deactivated or, worse, abandoned, your custom post types and all the content you've created can become inaccessible. Coding it yourself makes your "Portfolio" CPT a permanent, bulletproof part of your website.

A computer monitor displays a 'Register CPT' form on a wooden desk with a keyboard, mouse, coffee mug, and plant.

Where Does The Code Go?

You have a couple of options for where to place this PHP snippet. The most common spot people mention is the functions.php file of your theme. The big problem here? If you ever decide to switch themes, your custom post type will completely disappear. Not ideal.

A much smarter, more future-proof method is to create a simple, site-specific plugin. This sounds complicated, but it's really just a single PHP file that holds all your custom functions. This way, your CPTs stay active and functional no matter what theme you're using.

Deciding between a plugin and hand-coding can be tough. Here’s a quick rundown to help you figure out which path is right for your project.

CPT Creation Methods Compared: Plugin vs. Code

Feature Plugin Method (e.g., CPT UI) Code Method (functions.php)
Ease of Use Very high. User-friendly interface, no coding required. Low. Requires knowledge of PHP and the WordPress init hook.
Control Good. Offers many options, but you're limited to the plugin's UI. Total. Granular control over every argument and capability.
Performance Good. Well-coded plugins are efficient, but add some overhead. Excellent. No extra database queries or files to load. Leanest option.
Portability Theme-independent. CPTs exist as long as the plugin is active. Theme-dependent. CPTs vanish if you switch themes.
Long-Term Stability Depends on the plugin developer for updates and security. Rock-solid. Your code, your control. Not reliant on others.

While plugins are great for speed and simplicity, nothing beats the raw power and performance of custom code if you're comfortable with PHP.

The Core PHP Snippet

The magic happens with the register_post_type() function. This workhorse function takes two main things: the unique name (or slug) for your post type and a big array of arguments that tell WordPress exactly how it should behave.

Let's get our hands dirty and create that "Portfolio" post type. Drop the following code into your functions.php file or, even better, your site-specific plugin.

function portfolio_custom_post_type() {
$labels = array(
'name' => _x( 'Portfolios', 'Post Type General Name' ),
'singular_name' => _x( 'Portfolio', 'Post Type Singular Name' ),
'menu_name' => __( 'Portfolios' ),
'all_items' => __( 'All Portfolio Items' ),
'add_new_item' => __( 'Add New Portfolio Item' ),
'add_new' => __( 'Add New' ),
'edit_item' => __( 'Edit Portfolio Item' ),
'update_item' => __( 'Update Portfolio Item' ),
'view_item' => __( 'View Portfolio Item' ),
'search_items' => __( 'Search Portfolio Item' ),
);

$args = array(
    'label'               => __( 'portfolio' ),
    'description'         => __( 'Portfolio projects and case studies' ),
    'labels'              => $labels,
    'supports'            => array( 'title', 'editor', 'thumbnail', 'excerpt', 'custom-fields' ),
    'hierarchical'        => false,
    'public'              => true,
    'show_ui'             => true,
    'show_in_menu'        => true,
    'menu_position'       => 5,
    'menu_icon'           => 'dashicons-portfolio',
    'show_in_admin_bar'   => true,
    'show_in_nav_menus'   => true,
    'can_export'          => true,
    'has_archive'         => true,
    'exclude_from_search' => false,
    'publicly_queryable'  => true,
    'capability_type'     => 'post',
    'rewrite'             => array( 'slug' => 'portfolio' ),
    'show_in_rest'        => true, // Important for Gutenberg and REST API
);

register_post_type( 'portfolio', $args );

}
add_action( 'init', 'portfolio_custom_post_type', 0 );
Notice how it's all wrapped in an add_action hook called init. This is crucial because it tells WordPress to run your function at the perfect moment during its loading sequence.

Understanding the Arguments

I know that code block looks a bit intimidating, but it's really just a list of instructions. The $labels array is all about creating a friendly experience in the WordPress dashboard—it defines the text for buttons and menus.

The $args array is where the real power is. Here are a few of the most important settings you'll want to pay attention to:

  • supports: This tells WordPress which classic editor features to turn on. Think title, main content area, featured image (thumbnail), and so on.
  • public: Setting this to true is like a master switch. It makes your post type visible on the front end of your site and available in the admin dashboard.
  • has_archive: This one is huge. Setting it to true automatically creates an archive page for all your portfolio items. You'll find it at yoursite.com/portfolio.
  • rewrite: This lets you set a custom URL structure. We've defined the slug as portfolio to match the archive page.
  • menu_icon: You can pick any icon from the built-in Dashicons library to make your CPT stand out in the admin menu.

By manually defining every argument, you get pixel-perfect control over how your CPT works. You're not stuck with any defaults or limitations a plugin might impose. This is how you build a truly custom content structure that's perfectly suited to your project.

Once you save that code, a new "Portfolios" menu item will pop right into your WordPress dashboard. It will function just like the one made with a plugin, but with absolutely zero overhead.

Level Up Your CPTs with Custom Fields and Taxonomies

Okay, so you’ve got your "Portfolio" custom post type registered. That's a great first step, but let's be honest—right now, it's just a glorified blog post. You have a title, a content area, and a featured image. To make it a truly powerful, structured piece of content, we need to bolt on some custom data.

This is where the real magic happens with custom fields. Instead of just dumping all your project details—like the client's name or the launch date—into the main content editor, you can create specific, dedicated input fields for each piece of info. We're talking about things like "Client Name," "Project URL," or "Completion Date."

Taking this route transforms your portfolio items from simple pages into a well-organized database. It keeps everything consistent and makes it incredibly easy to pull that structured data and display it precisely where you want it later on with a page builder like Elementor.

A tablet displays an 'Advanced' form with 'Client Name' and 'Project URL' input fields, titled 'Custom Fields'.

Adding Structure with Advanced Custom Fields

While WordPress has built-in functionality for custom fields, it's clunky and not something I'd recommend for a serious project. For this job, pretty much everyone in the WordPress community turns to the Advanced Custom Fields (ACF) plugin. It's an absolute game-changer, giving you a simple, visual interface to create and manage complex groups of fields.

Let's walk through setting up a field group for our "Portfolio" CPT. Once you've installed and activated ACF, head over to ACF > Field Groups in your WordPress dashboard and hit "Add New."

First things first, give your field group a clear name, something like "Portfolio Project Details." Next up is the "Location" box. This is critical. You'll set a rule: Show this field group if Post Type is equal to Portfolio. This one step ensures these custom fields only show up when you're editing a portfolio item, keeping your regular posts and pages clean.

Creating Your First Custom Fields

Now for the fun part: adding the actual fields. We'll create a few essential ones for our portfolio.

  1. Client Name: Click the "Add Field" button. For the Field Label, type in "Client Name." You'll notice ACF automatically creates the Field Name (like client_name), which is what you'll use in code or dynamic tags. For the Field Type, a simple "Text" field is perfect.
  2. Project URL: Add another field. Label it "Project URL," but this time, select "URL" as the Field Type. This nifty setting validates the input to make sure only a proper web address can be entered.
  3. Completion Date: For our last field, use "Completion Date" as the label. Pick "Date Picker" for the Field Type. This gives you a nice, user-friendly calendar popup instead of just a plain text box.

Once you hit "Save Changes," navigate to Portfolios > Add New. Look below the main content editor—you should now see your slick, custom-built form, ready for you to start plugging in project data.

By combining custom post types wordpress with a tool like ACF, you're not just creating content—you're building a structured, queryable data model. This is the foundation for creating dynamic, filterable layouts that are impossible to achieve with standard pages.

Supercharging Filters with Custom Taxonomies

While custom fields are perfect for unique, one-off data points for each entry, custom taxonomies are all about grouping and categorization. Think of them as custom tags or categories. We already created a "Service Type" taxonomy, which lets us tag projects with terms like "Web Design" or "Branding."

This becomes incredibly powerful for your website's visitors. Imagine an archive page where a user can click a button to instantly filter your portfolio and see only the branding projects. That's what taxonomies were built for. They work hand-in-hand with custom fields to create a completely organized content system.

For instance, you might want to present this organized data in a clean, sortable format on the front end. To learn more about displaying structured information, you could explore options like building a dynamic table of elements that pulls directly from your custom fields.

By now, you should see how these three components—CPTs, custom fields, and taxonomies—form a robust triangle of content organization. It's the framework that sets the stage for building virtually any type of website you can imagine.

Displaying Your CPTs Beautifully with Elementor

Getting your content organized with custom post types and fields is a huge win. Seriously, pat yourself on the back. But that’s only half the battle. Now you have to take all that neatly structured data from the WordPress admin and make it look great on the front end for your visitors.

This is exactly where Elementor Pro's Theme Builder completely changes the game. Forget being stuck with your theme's default, often generic layouts. You get total creative freedom to design custom templates that automatically pull in your CPT data. The result? Consistent, dynamic, and professional-looking archive and single-post pages, all built without touching a single line of code. It’s the essential bridge between your content structure and your final design.

Designing a Single Template for Your Portfolio

Let's start by building a template for one specific portfolio item. The idea is to create a single, master layout that will automatically apply to every single entry in our "Portfolio" CPT. It will dynamically pull in the unique title, featured image, and all our custom field data for each project.

From your WordPress dashboard, head over to Templates > Theme Builder. Find "Single Post" and click "Add New." This next part is critical: Elementor needs to know where to apply this new template. This is handled by the display conditions.

  • Set the condition to Include.
  • From the dropdown, find and select Portfolio.
  • Hit Save & Close.

You're now looking at a blank canvas in the Elementor editor. You can drag in the standard widgets like "Post Title" and "Featured Image," and they'll magically populate with the content from each portfolio item.

But what about our custom fields? For that, we'll lean on Elementor's powerful Dynamic Tags feature.

Say you want to display the client's name. Just add a Heading widget. Next to the text field, you'll see a small database icon—that's for Dynamic Tags. Click it, scroll down to the "ACF" section, and pick "ACF Field." In the settings that appear, simply choose your "Client Name" field. That's it. You can do the same for the "Project URL" by adding a button and linking it to the corresponding ACF field using Dynamic Tags.

By creating one single template, you're establishing a consistent design language for your entire portfolio. If you ever decide to tweak the layout—maybe add a new project detail or change the fonts—you only need to edit one template. The change will instantly cascade across every single portfolio item on your site.

Building an Archive Template for Your Grid

A single portfolio page is great, but your visitors need a way to browse all your work at once. That's what an Archive template is for. Go back to the Theme Builder, but this time, choose "Archive." Just like before, set the display conditions to Include > Portfolio Archive. This tells WordPress to use your custom design whenever someone visits yoursite.com/portfolio.

The star of the show on this page is the Posts widget. Drag it onto your canvas. In the widget's Query settings, make sure the Source is set to "Portfolio." Instantly, you'll see a grid of all your projects appear. From here, you can fine-tune everything—the number of columns, the layout style, and what info shows up on each card, like the featured image and title.

This is also where our custom taxonomy, "Service Type," becomes incredibly handy. You can easily add a filter bar to your archive page, letting visitors sort your projects by "Web Design," "Branding," or whatever services you offer. This small touch makes for a much more engaging and user-friendly experience.

Using Advanced Dynamic Post Widgets

While Elementor's built-in Posts widget is solid for most cases, you can build even more sophisticated and targeted layouts with specialized add-ons. Exclusive Addons, for instance, offers a whole suite of dynamic post widgets that give you much finer control over your CPT archives.

The Dynamic Posts widget, for example, lets you create complex queries and unique grid designs that go far beyond the basics.

This screenshot gives you a glimpse of the extensive query controls. You can filter your posts by multiple taxonomies, specific authors, or even by the values in your custom fields.

With this kind of power, you could create a highly curated showcase on your homepage that only pulls portfolio items tagged with "Featured" and completed in the last six months. For a deeper dive into what’s possible, check out our guide on dynamic post widgets for Elementor. It’s this level of granular control that separates a generic portfolio from a truly impressive user experience.

Got Questions About Custom Post Types?

As you start getting your hands dirty with custom post types in WordPress, some practical questions are bound to pop up. It's one thing to understand the theory, but another to handle the real-world details that come along with it.

Let's clear up some of the most common points of confusion so you can move forward with confidence.

What's The Difference Between a CPT and a Category?

This is a big one, and it trips a lot of people up. The easiest way to think of it is like a filing cabinet.

  • A Custom Post Type is like adding a brand-new drawer to the cabinet. Maybe you need a drawer just for "Events" or another one for "Portfolio Projects." It's a completely separate container built for a unique type of content.
  • A Category, on the other hand, is just a folder you put inside an existing drawer. If "Blog Posts" is your main drawer, then "Marketing Tips" and "SEO Guides" are categories—folders you use to organize the documents within that specific drawer.

You create a CPT for a fundamentally new kind of content. You use taxonomies (like categories or tags) to group and filter the content within that CPT.

What Happens If I Delete a CPT Plugin?

So, you've used a handy plugin like CPT UI to create your post types, and then you decide to deactivate or delete it. The first thing you'll notice is that your CPTs vanish from the WordPress admin menu. It can be a bit of a shock, but don't panic.

Your actual content—every single portfolio item, event, or testimonial you've painstakingly entered—is not deleted. That data is still perfectly safe in your WordPress database. The problem is, it becomes inaccessible because you've removed the instructions telling WordPress what that post type is.

To get everything back, you'd have to either reactivate the plugin or, better yet, re-register the CPT using code, making sure to use the exact same slug. This is a major reason why many experienced developers prefer the code-based method; it provides long-term stability that isn't tied to a plugin.

Can I Add CPTs to My Main Blog Feed?

By default, WordPress likes to keep things tidy. Your custom post types are kept separate from your main blog feed, which is reserved for standard "Posts." But what if you want to mix them? For instance, maybe you want your latest "Case Study" to show up right alongside your regular articles on the homepage.

You absolutely can. This requires adding a small PHP snippet to your site's functions.php file. The code uses a hook called pre_get_posts to modify WordPress's main query, telling it to fetch both post and your custom post type (e.g., case-study) when loading the main blog page. It’s a simple tweak that can make your site feel much more integrated.

How Do I Make My CPTs Searchable?

When you first register a custom post type, you get to decide if it shows up in your website's internal search results. This is a small but critical setting for user experience. After all, if someone is searching for a product or a knowledge base article, you want them to find it!

Whether you're using a plugin like CPT UI or writing the registration code yourself, look for a setting called exclude_from_search. To make sure your CPT content is discoverable, you need to set this value to false. This tells WordPress to include entries from this post type every time a visitor uses the search bar.


Ready to build truly dynamic and organized websites? Exclusive Addons provides the advanced widgets you need to display your custom post types beautifully in Elementor, from sophisticated grids to filterable archives. Unlock your design potential with Exclusive Addons today.