Sunday, March 3, 2024

Create Custom Post Type Loops Templates with Dynamic Content + Elementor

Creating Custom Post Type Loop Template WordPress

Are you using Elementor Plugin and struggling to create nice post type loops? If yes, then bear with me and I will share with you how you can create custom post type loops templates with Dynamic Content for Elementor Plugin, and of course, we will also be using Elementor Pro Plugin for the same.

What is Custom Post Type in WordPress?

Custom Post Types are nothing but content types that we see in our WordPress Dashboard such as Posts, Pages. These post types have taxonomies, categories, tags and archives. Apart from the standard post types already present, website owners may need to extend the post types for various reasons. And in such cases, they take recourse to custom post types to extend the post types on their Websites.

Learn More About Post Type here

In our tutorial, we are going to use a Custom Post Type UI Plugin to create a new post type for our WordPress website.

What are Custom Fields?

WordPress allows the users to store meta data for the specific post types in key-value pairs and such metadata is referred to as custom fields. We use this metadata or custom fields to achieve more complex results. For example, if we want to store taglines for our posts, then we can achieve this by using custom fields.

Learn More About Custom Fields here

In our tutorial, we are going to use Advanced Custom Fields aca ACF Plugin to create custom fields for our post types.

Why is Custom Post Type Loops and why we call it loops?

A post type can have multiple posts stored in an array and can be displayed through the loops such as while loop as shown in the below image.

// The Query
$the_query = new WP_Query( $args );
// The Loop
if ( $the_query->have_posts() ) {
    echo '<ul>';
    while ( $the_query->have_posts() ) {
        echo '<li>' . get_the_title() . '</li>';
    echo '</ul>';
} else {
Custom Post Type Loops WordPress

So, when we show the posts with their data in a template form, we may call them post type loops. We may also call it querying by Post Type as we use WP_Query

Querying by post type WordPress

So, now we have come to know some of the basics about what is custom post type, what is custom fields and what are post type loops. Lets get started.

How To Create Custom Post Type Loops Templates with + Elementor

Installing Required Plugins

For this tutorial we are using the below-listed plugins:

  1. Elementor & Elementor Pro
  2. Dynamic Content for Elementor
  3. ACF (Advanced Custom Fields)
  4. Custom Post Type UI

Create A New Post Type


Create Custom Fields for the Post Type

To perform this step, make sure you have the advanced custom fields(ACF) plugin installed. When installed, you can find the Custom Fields section right in your WordPress menu.

Custom Fields WordPress

Here you can create a new field group, name it something, add fields in it and assign that to a location.

Custom Fields for WordPress How To

In the above screenshot, you can notice that I have created a field group named “Coupon Fields”, added 5 custom fields in it. And also have assigned it to Coupon Post Type that I created easier with CPT UI for that purpose.

So, now we are ready with a new Custom Post Type and some custom fields for that post type.

Create Elementor Loop Template for Post Type Loop

Go To Elementor Templates > Theme Builder and add a new “section” template.

Now basically we have to design a section like highlighted in the below screenshot. We can call it our custom post type design and when it will be queried in the archive, will change the game.

Creating Custom Post Type Loop Template WordPress

And remember we will be using dynamic fields for the data such as Post Title, ACF keys and all that.

Post Type Dynamic Tokens

Once you have designed your section, just save it.

Create Archive Template for Post Type

Go To Elementor Templates > Theme Builder and add a new “archive” template.

To perform the below step, make sure you have already installed and activated dynamic content for elementor plugin. 

If yes, then you need to find the dynamic posts widget and drag and drop it on the section.

Dynamic Posts Loop

You will need majorly two things to set up on this widget viz. 1) Post Type 2) Loop Template (that you created earlier)

Dynamic Posts Loop for WordPress

In the post type you need to select the post type you created and in the dynamic content, you can choose the loop template that you created.

There are also a lot of options that you can explore and experiment on trial and error. Once ready with your posts loop archive you can go ahead and set the display conditions for this template and set it to the newly created custom post type archive.

Display Conditions for Post Type Loops

So, now you have successfully created a loop template for your custom post type in WordPress. If you have any questions, you can comment down below or reach us out on our social media platform.

Comments 2

  1. jahanzeib shah says:

    unfreez my tiktok accunt

  2. Adie says:

    I would love a complete walk through of howto do this for something like a travel website… Including the search query usually on the front page?

Leave a Reply

Your email address will not be published. Required fields are marked *

I agree to the Terms & Conditions and Privacy Policy.

Related Posts

Stay tuned with us

Table of Contents

Welcome Back!

Login to your account below

Retrieve your password

Please enter your username or email address to reset your password.

Add New Playlist

DroidCrunch Giveaway

Amazon Gift Card worth $15

Participate now and get a chance to become a lucky winner to receive the reward.​