Next to the previous tutorial on creating a simple listing using Meta Box and WP Grid Builder, we’re going to do the same thing using Bricks today. We also display the information from custom fields created by Meta Box and create some filters for posts.

Sample of creating a simple listing using Meta Box and Bricks

Video Version

Before Getting Started

There’s something we should clarify before getting started.

First of all, we’ll need a custom post type for restaurants, then all the information about each restaurant will be saved in a post. The post's title and featured images are the restaurant's name and image. Other information such as status, address, and logo will be saved in custom fields.

That’s in the backend. On the frontend, means the listing page, we’ll have a content area for displaying post and some filters as the following:

The archive page displays the list of posts and has the filters as well

For those filters, I use taxonomy to classify restaurants into groups and filter them by voucher.

To have custom fields and taxonomy for saving information, we need the Meta Box plugin and its extensions. The Meta Box core plugin is free and available on wordpress.org. For the extensions, they’re in the Meta Box AIO. If you haven’t had it you can download and install each extension individually. The list of extensions we need for this tuts are:

For the last one, we use Bricks for this practice. It already has the native integration with Meta Box that helps you to get and display data on the page easily.

Step 1: Create a New Custom Post Type

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

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

After publishing, you will see a new menu in your dashboard, that’s your created custom post type.

Step 2: Create Custom Fields and Taxonomy for the Post Type

In the Admin Dashboard, go to Meta Box > Custom Fields > Add New to create custom fields.

Here are the custom fields I created. You can freely choose any type of field for your case because Meta Box supports over 50 field types.

Go to Meta Box > Custom Fields > Add New to create custom fields.

My fields are pretty simple, so I just need to enter the label and ID for them. Remember to choose the easy-to-remember ID as you will need them in the next step.

After finishing creating the fields, move to the Settings tab. Then, select the Post Types as Restaurant in the Location section to apply these fields to this post type.

Move to the Settings tab. Then, select the Post Types as Restaurant in the Location section to apply these fields to this post type

As I said before, we use taxonomy for the filters, so go to the Taxonomies menu then create a new one. The taxonomy is to save information about restaurant vouchers.

Create a custom taxonomy to save information about restaurant vouchers

When setting the taxonomy, if you want to display it as a column in the admin screen, go to the Advanced tab and tick the Show admin column box. This setting is available only when the MB Admin Columns extension has been activated.

Set the taxonomy to show as an admin column

Also in the settings of the creating taxonomy, go to the Post Types tab and choose the post type you've just created.

Apply the taxonomy to a post type

Now, publishing the taxonomy then you can add terms for it.

Create terms for the taxonomy

Finally, let’s create a post for a restaurant, you will see the custom fields and the voucher taxonomy with terms appear.

You will see the custom fields and the voucher taxonomy with terms appear in the post editor

Step 3: Create the Page with Bricks

Go to Pages > Add New to create a new page. After updating, select Edit with Bricks.

Create a new page then edit it with Bricks

In the page editor with Bricks, add a Container element to cover all the restaurants’ information.

In the page editor with Bricks, add a Container element to cover all the restaurants’ information.

Then, add a Heading element to display the title of the page and type the name of the page on it.

Add a Heading element to display the title of the page and type the name of the page on it

In the container, add the Posts element then you will see a list of blog posts as default with featured image, title, and short description in the preview.

In the container, add the Posts element then you will see a list of blog posts as default with featured image, title, and short description in the preview.

As you know, the posts we need to show here are ones of the Restaurant post type instead of blog posts. So, go to the Query section of the Posts element, change the Post Type to the one we want.

Go to the Query section of the Posts element, change the Post Type to the one we want.

Also in the Query section, you also can change the posts order as you want.

Next, if you want to change the page’s layout or the display of the featured image, go to the Layout and the Image section. There are several exciting options that you can choose from here.

Change the page’s layout or the display of the featured image

Now is the most important part of this tutorial, let’s add data from custom fields to the page. Still in the settings of the Posts element, go to the Fields section.

Add data from custom fields to the page

I’ll remove the post excerpt and add some fields. Just click Add Field > type the name of the taxonomy or the custom field you want in the Dynamic Data. Then, the data of each post will immediately display in the preview.

Add field then choose a taxonomy from the Dynamic Data box

Add field then choose a custom field from the Dynamic Data box

In this step, pay attention to the logo. When you add the logo field, it will display the text only. Just add an extra attribute to the logo field as follows to have the image.

Add an extra attribute to the logo field to have the image

In addition, since Bricks doesn’t support creating classes for the Posts element, if you want to style each information later, you can use the HTML tag. For example, I set the restaurant name as H2, the address as H3, the voucher as P, and the status as div. By the way, this HTML tag also is good for SEO, so don’t forget to set it.

Set the HTML tag for elements

After having all the needed information, just drag the fields to rearrange them to the right order as you want.

Drag the fields to rearrange them to the right order as you want

The last one is creating the filters. Go to the Filter section and choose the taxonomy that you use to classify the posts. Then you will see it in the preview.

Go to the Filter section and choose the taxonomy that you use to classify the posts

Step 4: Add Dynamic Class for the Status Information

I have two statuses for the restaurant, so I want to display them with different looks to identify them clearly. To do it, I use JS to set dynamic classes for them.

Install the Simple Custom CSS and JS plugin to add custom CSS or JS to your website easily.

Install the Simple Custom CSS and JS plugin to add custom CSS or JS to your website easily.

After activating, go to the Custom CSS and JS menu to add code. I put all the code on Github so that you can refer to it for more details. You can set it to add this code to the footer to avoid slowing down the page.

You can set it to add this code to the footer to avoid slowing down the page.

Code explanation:

This line is to create a dynamic class based on the data of the restaurant's status, which has the HTML tag set as div above.

This line is to create a dynamic class based on the data of the restaurant's status, which has the HTML tag set as div above.

This code is to point out when the class is open or close.

This code is to point out when the class is open or close. If the obtained data is open, the class will be open. If it is close, the class will be close. Depending on the created class, I will have two different styles for the two statuses of the restaurant.

Step 5: Style the Page

Back to the page editor with Bricks, change the layout of the Container a little bit such as margin and padding, as well as set the alignment for the Heading.

change the layout of the Container a little bit such as margin and padding

change the alignment for the Heading

Bricks provide pretty much settings to style the element. However, for the advanced style as I want for voucher, status, and logo, I need some CSS.

Go to the setting section of the Posts element > Style > CSS and add some CSS.

Add CSS to style the archive page

I placed all of the code on Github so you can look it up for further information.

Now, back to the page, all information is displayed better, especially the status, logo, voucher.

Back to the page, all information is displayed better, especially the status, logo, voucher.

The filters also work well.

The filters on the archive page also work well.

Last Words

As you can see, with the help of Bricks, creating a simple listing page became so easy, especially for those who haven’t known much about coding. If you are looking for a listing page with advanced filters, please refer to this tutorial (with code) or this tutorial (with UI).

Hopefully, this tutorial will make sense to you. Let’s try it out and share the results in the comment section. See you soon in upcoming tutorials!

Other case studies you might be interested in

  1. Create A Dynamic Landing Page in WordPress Using Custom Field
  2. Create a Filter to Find Hotels by Location
  3. Create an OTA Website Like Booking.com with Meta Box Plugin - P1: Create a Page to Introduce Hotel Rooms
  4. Create an OTA Website Like Booking.com with Meta Box Plugin - P2: Create Filters on the Archive Page
  5. Create an OTA Website Like Booking.com with Meta Box Plugin - P3: Create Filters for Single Hotel Pages
  6. Create Dynamic Favicon in WordPress using Meta Box plugin
  7. Create Posts Series in WordPress Using Meta Box
  8. Display a User List On the Frontend with Meta Box
  9. Display The Latest Products Section - P2 - Using Meta Box and Elementor
  10. Display The Latest Products Section - P3 - Using Meta Box And Oxygen
  11. How to Add Custom Fields to Display Banners using Meta Box Plugin
  12. How to Add Guest Author in WordPress using Meta Box (Part 1)
  13. How to Add Guest Author in WordPress using Meta Box (Part 2)
  14. How to Add Related Posts to WordPress Using Meta Box
  15. How to Build a Hotel Booking Website Using Meta Box - P1
  16. How to Build a Hotel Booking Website Using Meta Box - P2 - Booking Page in Backend
  17. How to Build a Hotel Booking Website Using Meta Box - P4 - Booking Management Page
  18. How to Build a Hotel Booking Website Using Meta Box – P3 – Booking Page for Customer
  19. How to Create a Classified Ads Website using Meta Box
  20. How to Create a Product Page using Meta Box Plugin
  21. How to Create a Recipe with Meta Box Plugin
  22. How to Create a Simple Listing - P2 - Using Meta Box and Bricks
  23. How to Create a Team Members Page - P1- Using Meta Box and Elementor
  24. How to Create a Team Members Page - P2 - Using Meta Box and Oxygen
  25. How to Create a Team Members Page - P3 - Using Meta Box and Bricks
  26. How to Create ACF Flexible Content Field with Meta Box
  27. How to Create an Auto-Updated Cheat Sheet in WordPress
  28. How to Create an FAQs Page Using Meta Box
  29. How to Create Buttons with Dynamic Link using Custom Fields
  30. How to Create Category Thumbnails & Featured Images Using Custom Fields
  31. How to Create Download Buttons Using Custom Fields with Meta Box Plugin
  32. How to Create Online Admission Form for School or University
  33. How to Create Online Reservation Form for Restaurants using Meta Box
  34. How to Create Taxonomy Thumbnails & Featured Images - P2 - Using Meta Box and Oxygen
  35. How to Display Images from Cloneable Fields - P1 - with Gutenberg
  36. How to Display Images from Cloneable Fields - P2 - with Oxygen
  37. How to Display Opening Hours for Restaurants - P1 - Using Meta Box + Gutenberg
  38. How to Display Product Variations - P1 - Using Meta Box and Gutenberg
  39. How to Display Product Variations - P2 - Using Meta Box and Oxygen
  40. How to Manually Reorder Posts with Meta Box
  41. How to Use Custom HTML Field to Output Beautiful Texts or Output Custom CSS

1 thought on “How to Create a Simple Listing - P2 - Using Meta Box and Bricks

  1. I hope to see advanced tutorial using Meta Box + Bricks.

    Example like real estate would be great

Leave a Reply

Your email address will not be published.