Monday, April 21, 2025

•

2 min read

How to Create a Custom Post Type and Enable it for Elementor

If you've ever wanted to build unique content types beyond posts and pages, things like portfolios, team members, or case studies, custom post types are the way to go. And the best part? You can make them editable in Elementor with just a couple of steps. Let’s walk through it.

Step 1: Create a Custom Post Type

We’ll start by registering a new custom post type directly in your theme. Open your active theme’s `functions.php` file (usually found in `wp-content/themes/your-theme-name/`) and add the following code:

php
1function create_custom_post_type() {
2      register_post_type( 'my_custom_post', array(
3          'labels' => array(
4              'name'          => __( 'My Custom Posts', 'textdomain' ),
5              'singular_name' => __( 'My Custom Post', 'textdomain' ),
6          ),
7          'public'       => true,
8          'has_archive'  => true,
9          'menu_icon'    => 'dashicons-admin-post',
10          'supports'     => array( 'title', 'editor', 'thumbnail', 'excerpt' ),
11          'show_in_rest' => true, // Enables block editor and REST API support
12      ));
13  }
14  add_action( 'init', 'create_custom_post_type' );

This code registers a new post type called **My Custom Posts**. The `supports` array tells WordPress which features to include, like the title, editor, and featured image. The `show_in_rest` flag ensures it works nicely with the block editor and Elementor’s dynamic content tools.

Step 2: Enable the Custom Post Type in Elementor

Once your post type is registered, you’ll need to make sure Elementor recognizes it. Elementor doesn’t automatically enable editing for new post types, so here’s how to fix that:

  1. Go to **Elementor → Settings** in your WordPress dashboard.
  2. Under the **Post Types** section, check the box next to **My Custom Posts**.
  3. Click **Save Changes**.

That’s it, Elementor can now edit and style your new post type. You’ll be able to design templates, single layouts, and dynamic archives just like you would for regular posts or pages.

Full Working Example

php
1// functions.php
2  
3  function create_custom_post_type() {
4      register_post_type( 'my_custom_post', array(
5          'labels' => array(
6              'name'          => __( 'My Custom Posts', 'textdomain' ),
7              'singular_name' => __( 'My Custom Post', 'textdomain' ),
8          ),
9          'public'       => true,
10          'has_archive'  => true,
11          'menu_icon'    => 'dashicons-admin-post',
12          'supports'     => array( 'title', 'editor', 'thumbnail', 'excerpt' ),
13          'show_in_rest' => true,
14      ));
15  }
16  add_action( 'init', 'create_custom_post_type' );

WordPress Developer Handbook: Registering custom post types:

Elementor documentation: Making custom post types editable:

You now have a working custom post type that integrates perfectly with Elementor. From here, you can build custom templates using the Theme Builder, display your posts dynamically, or even register multiple post types for different kinds of content, all without any extra plugins.

About the Author
Jonas Lindemann

I've worked in SEO for more than ten years and helped over 100 businesses rank higher, mostly local businesses, e-commerce stores and SaaS companies. As co-founder of LPagery I work on local SEO, programmatic SEO and AI search visibility, and I test the strategies in these articles on our own sites and with our customers.