DEV Community

Cover image for How to Create a Product Page - P4 - Using Meta Box and Elementor
WP Meta Box Plugin
WP Meta Box Plugin

Posted on

How to Create a Product Page - P4 - Using Meta Box and Elementor

Let’s see how to create a great product page using Meta Box and Elementor with some simple steps! I also take a car rental for the product as an example.

Example of a product page

Video Version

https://youtu.be/gI0M5nuzPj8

Before Getting Started

The product page is a singular page. All of its information is saved in a post of a custom post type. The name of the product and its descriptions are the title and content of the post. The remaining detailed information will be saved in the custom fields that are created by Meta Box.

A product page is a singular page

So, in this practice, we need these tools:

Create a New Custom Post Type

Go to Meta Box > Post Types > New Post Type to create a new custom post type.

Create a new custom post type

Create Custom Fields

The product has extra detailed information, so we’ll create custom fields to save them. Go to Meta Box > Custom Fields, then create fields as you want.

Create custom fields

In my case, I just take a typical example of car rental with some common fields. Here are the fields that I created.

The created custom fields

To know more about the field type, you may have your own specific information for the product. So, you may want to find out each field type to get the matching one. We have a video to talk about all the field types of Meta Box in detail. You can dig into it.

After creating all fields, move to the Settings tab > Location > choose Post Type as Car Rental to apply these fields to this post type.

Set location for the created custom fields as post type

In the post editor, you will see all of the created custom fields.

All created fields in the post editor

Create a Template

Go to the Elementor Theme Builder and create a new template. Since it’s for a singular page of a custom post type, we’ll create it in the type of a single post.

Create a template

After setting the preview for the template, let’s edit it.

My product page has two columns like this:

Two columns of the product page

So, first, add a widget and choose the layout for it.

Add a widget and choose the layout

In the first column, select the Image Carousel to display the image gallery as a slider. Then, to get the image that is saved in the custom field, go to the Dynamic Tags, find the Meta Box Field in the Post section, and choose the field that is set for the image. After that, you can see all of the images appear

Find the corresponding field to get the data by using Dynamic Data

Move to the second column to display other information about the product. The first one is the product's name which is saved in the post title. So, choose the Post Title element > select the Post Content element to get the product’s description.

Choose the post title element for the product's description

For the rental price information, choose the Text Editor element. Since the rental price is saved in custom fields created by Meta Box, also use the Dynamics Tags > Meta Box Field in the Post section > choose the corresponding fields. A number will be displayed without a unit of the pricing.

Choose the Text Editor element for the rental price information

To have the unit displayed, go to the Advanced section, and add the currency unit.

Add the currency unit in the Advanced section

For the rest of the information in this section, they have the same style with 2 columns. The first one is the title, and the second one is the information that is obtained from the custom fields.

The rest of the information will have the same style with 2 columns

Thus, we’ll use the Inner Section with 2 columns as well for each row.

Use the Inner Section with 2 columns

2 columns for each row

The first column is the title. So, select the Heading element, then just name and style it.

Select the Heading element for the title

In the second column in the Inner Section element, add a Text Editor element, then connect it to the custom field to get the data using the dynamic tags. Take Car Year as an example.

Add a Text Editor element in the Inter Section element then connect it to the right field

You can duplicate the Inner Section to have other rows and change the information to get the right one.

After getting all of the information about the product, remember to set the condition for this template to apply it to the singular page of the Car Rental.

Set the condition for the template

Now, in the frontend, all of the product's detailed information is displayed.

All the product's information is displayed

Style the Page

Still in the editor of the created template, just customize each element to get the wanted style.

Style the Page

After styling, you’ll see the new look.

The final result after styling

Last Words

Hopefully, all the following steps above can give you a hand in creating a detailed product page. If you use other page builders, you can dig into the series on how to create a product page with different page builders.

If you want to suggest any tutorials, feel free to leave a comment. Thank you for reading. Good luck!

Top comments (0)