Sometimes you may want to feature some products on your homepage. It's a popular technique to improve conversion by attracting customers to the most irresistible products. So, let’s see how we showcase featured products on a page with Meta Box and Breakdance.

I use the restaurants as an example of the products.

The featured products using Meta Box and Breakdance.

Video Version

Before Getting Started

We will create a section to show the featured products which are chosen manually in the backend. The products are stored in a post type, and each one is a post. The product's information, in this case as the restaurants, may include extra information that is saved in the custom fields.

These are some tools we need for this practice:

  • Meta Box core plugin: to have a framework for creating a custom post type and custom fields;
  • MB Custom Post Type: to create a custom post type for the products;
  • MB Box Builder: to create custom fields to save the products information, as well as the custom field to set the product to be featured or not;
  • MB Admin Columns (optional): to display the custom fields as an admin column to easily see the information. I use it to show you which products will be featured, so you can easily compare it with the results.
  • Breakdance: to build the homepage and the section to showcase the products.

Create a New Custom Post Type

Go to Meta Box > Post Types to create a new post type for the products. I meant restaurants in my case.

Create a new custom post type for your products

Create Custom Fields

Go to Meta Box > Custom Fields to create fields to save extra information for the restaurants as usual.

Create fields to save extra information for the products

Beside some typical fields for demonstration, I have a special field in the Switch type. This special field is to select which restaurant is featured on the homepage.

The Switch field is to select which restaurant is featured on the homepage.

This field will display as a button and has two status. The Off status will indicate that you do not want to recommend the restaurant. Otherwise, the On status will let us know that you want to showcase it.

If you want to feature the restaurant, just turn on the button

I’ll show the values of this field in the admin column to see whether the restaurant is featured or not by turning on the button like in the image below. This setting is available only when you have the MB Admin Columns extension from Meta Box.

The restaurant is featured when you have MB Admin Columns

You can see how it displays on the admin dashboard.

The posts displayed in the section from the column.

After having all the fields, go to the Settings tab > choose Location as Post type > select Restaurant to apply the fields to it.

Set location to apply the fields to the Restaurant post type.

In the post editor, you’ll see the created custom fields. The Switch field is also displayed. You can turn on or turn off the button to choose to feature your product or not.

Turn on or turn off the button to choose to feature the restaurant or not.

Create the Global Block

With Breakdance, you should create a global block to get and display information from a post first, including from the custom fields in that post, then use this global block to display them anywhere on your site.

Go to Breakdance and create a new global block.

Create a new global block

Remember to set a post for the live preview.

Set a post for the live preview

My global block is to display the information of each post in a box like this.

The information of a restaurant

Set the Condition to Get Featured Posts

First, select the Div element to cover the block.

Select the Div element to cover the block

Go to the settings of the Div element, then the Conditions section, add a condition to choose which posts will be displayed.

Add a condition to choose which posts will be displayed.

Choose the Dynamic Data option from the list to set the condition based on the data saved in custom fields.

Choose the Dynamic Data option to set the condition based on the data saved in custom fields.

This condition will be set based on the value of the created Switch field. So, in the Metabox section, choose the name of the field.

In the Metabox section, choose the name of the Switch field.

The Switch field has two statuses: On and Off, corresponding to the value 1 or 0. So, enter 1 into the box because it’s defaulted to the On status. It means that only posts where the Switch field is On status will be get and display information.

Put 1 into the field value box which corresponds to the On status.

That’s all for the condition.

Display the Products Information

Now, add some elements to display information about the restaurant.

Inside the Div, select the Image element to show the restaurant’s image. And click on the icon below to insert dynamic data.

Click on the icon to insert dynamic data

Then, choose the Featured Image option from the Post section.

Choose the Featured Image option from the Post section

You see that the restaurant’s image is displayed immediately.

The restaurant’s image is displayed immediately

For the voucher information, choose the Text element. As the voucher is saved in the custom field created by Meta Box, we’ll insert the dynamic data into the Text element. Then, you will see the field name in the Metabox section. Choose it.

Get the voucher information

To get the restaurant’s name automatically, add the Heading element, and connect it with the title of the post.

Get the restaurant’s name

As a result, the name of the restaurant appears.

The name of the restaurant appears

For the address information, do the same with the voucher. Add a Text element, then insert data from the Address field.

Get the address information

The last information we want to display is the restaurant’s logo. Choose the Image element. The logo is saved in the custom field as well, so we’ll also insert the dynamic data into this element. Then, the logo of the restaurant appears.

Display the restaurant’s logo

We have just finished displaying information about a restaurant on the block.

Create the Featured Section

Let’s edit the homepage with Breakdance to add a new section to the page.

Now, add a Heading element and name the section.

Add a Heading element and name the section

To display the wanted posts from the created global block, we need the Post Loop Builder element.

Choose the Post Loop Builder element to display the wanted posts from the created global block.

In the Global Block section of the Post Loop Builder settings, choose the name of the global block we’ve just created.

Choose the name of the created global block

There is no product or any information display now. So, move to the Query section of the Post Loop Builder element > choose Custom, and edit the query like this.

Edit the query to display the products information

In there: In the Source data, it’ll be automatically set as the Post Types, then choose the name of the post type you want to get the post from. I chose Restaurants. You also can change some other settings as you wish, but I keep them as default.

Now, there’re some posts displayed with the layout and information exactly as we set in the created global block.

Some products display on the frontend.

When I change the layout of this section a little bit, I see it's not like what I’m thinking. You can see something weird. There may be some blank blocks in the section.

There may be some blank blocks in the section.

They do not disappear on the frontend. It is simply the place for the posts that didn’t meet our conditions. Although the posts’ information won’t display as the condition regulates, the posts still have their own space.

To remove them, add a Code Block on your homepage, and input some JavaScript to disappear the voids.

Add a Code Block, and input some JavaScript to disappear the voids.

jQuery('.ee-post').filter(function() {
return jQuery(this).text().trim() == ""
}).remove();

This is how the section looks after removing the voids.

The featured restaurants section after removing the voids

Style the Section

Go back to edit the global block to style the display of the post information. Change the settings of each element to get the wanted look.

Then back to the homepage, you will see all the featured restaurants are displayed as good as you want.

All the featured products are displayed as good as you want

Last Words

Let’s try out this simple tutorial and effortlessly showcase your featured products using Meta Box and Breakdance. In the event that you’re using another page builder or just do it without any page builder, just go to this series and look for the one that fits your case.

If you like an automated approach for selecting and displaying products based on specific conditions instead of doing it manually, the series ‘How to show posts with specific criteria’ will give you a hand.

We'd love to see what you create, so don't forget to share your results with us!

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 The Latest Products Section - P2 - Using Meta Box and Elementor
  9. Display The Latest Products Section - P3 - Using Meta Box And Oxygen
  10. How to Add Custom Fields for WooCommerce - P2 - Using MB Views
  11. How to Add Custom Fields to Display Banners using Meta Box Plugin
  12. How to Add Guest Authors and Guest Posts - Using Meta Box
  13. How to Add Related Posts - Using Custom Fields
  14. How to Build a Hotel Booking Website Using Meta Box - P1
  15. How to Build a Hotel Booking Website Using Meta Box - P2 - Booking Page in Backend
  16. How to Build a Hotel Booking Website Using Meta Box - P4 - Booking Management Page
  17. How to Build a Hotel Booking Website Using Meta Box – P3 – Booking Page for Customer
  18. How to Create a Classified Ads Website using Meta Box
  19. How to Create a Custom 404 Page in WordPress - P1 - Using Meta Box and Elementor
  20. How to create a FAQs page - P5 - Using Meta Box and Breakdance
  21. How to Create a Product Page - P2 - Using Meta Box and Oxygen
  22. How to Create a Product Page - P3 - Using Meta Box and Bricks
  23. How to Create a Product Page - P4 - Using Meta Box and Elementor
  24. How to Create a Product Page - P5 - Using Meta Box and Gutenberg
  25. How to Create a Product Page - P6 -Using Meta Box and Breakdance
  26. How to Create a Product Page - P7 - Using Meta Box + Kadence
  27. How to Create a Product Page - P8 - Using Meta Box and Brizy
  28. How to Create a Product Page - P9 - Using Meta Box and Divi
  29. How to Create a Product Page using Meta Box Plugin
  30. How to Create a Recipe - P2 - Using Meta Box and Oxygen
  31. How to Create a Recipe - P3 - Using Meta Box and Elementor
  32. How to Create a Recipe - P4 - Using Meta Box and Bricks
  33. How to Create a Recipe - P5 - Using Meta Box and Zion
  34. How to Create a Recipe - P6 - Using Meta Box and Brizy
  35. How to Create a Recipe - P7 - Using Meta Box and Breakdance
  36. How to Create a Recipe - P8 - Using Meta Box and Kadence
  37. How to Create a Recipe - P9 - Using Meta Box and Divi
  38. How to Create a Recipe with Meta Box Plugin
  39. How to Create a Simple Listing - P2 - Using Meta Box and Bricks
  40. How to Create a Simple Listing - P3 - Using Meta Box and Breakdance
  41. How to Create a Simple Listing - P4 - Using Meta Box and Elementor
  42. How to Create a Team Members Page - P1- Using Meta Box and Elementor
  43. How to Create a Team Members Page - P2 - Using Meta Box and Oxygen
  44. How to Create a Team Members Page - P3 - Using Meta Box and Bricks
  45. How to Create a Team Members Page - P4 - Just Meta Box
  46. How to Create a Team Members Page - P6 - using Meta Box and Breakdance
  47. How to Create a Team Members Page - P7 - Using Meta Box and Kadence
  48. How to Create a Video Gallery Page - P2 - Using Meta Box + Bricks
  49. How to Create a Video Gallery Page - P3 - Using Meta Box and Breakdance
  50. How to Create a Video Gallery Page - P4 - Using Meta Box + Elementor
  51. How to Create a Video Gallery Page - P5 - Using MB Views
  52. How to Create a Video Gallery Page - P6 - Using Meta Box and Zion
  53. How to Create a Video Gallery Page Using Meta Box + Oxygen
  54. How to Create ACF Flexible Content Field with Meta Box
  55. How to Create an Auto-Updated Cheat Sheet in WordPress
  56. How to Create an FAQs Page - P1 - Using Meta Box and Elementor
  57. How to create an FAQs page - P2 - Using Meta Box and Oxygen
  58. How to create an FAQs page - P4 - Using Meta Box and Bricks
  59. How to Create an FAQs Page - P6 - Using MB Views
  60. How to Create an FAQs Page - P7 - Using Meta Box and Divi
  61. How to Create an FAQs Page - P8 - Using Meta Box and Kadence
  62. How to Create an FAQs Page - P9 - Using MB Blocks
  63. How to Create an FAQs Page -P3- Using Meta Box
  64. How to Create Buttons with Dynamic Link using Custom Fields
  65. How to Create Category Thumbnails & Featured Images Using Custom Fields
  66. How to Create Download and Preview Buttons - P1 - Using Meta Box and Bricks
  67. How to Create Download and Preview Buttons - P2 - Using Meta Box and Oxygen
  68. How to Create Download and Preview Buttons - P3 - Using MB Views
  69. How to Create Download Buttons in WordPress - Using Custom Fields
  70. How to Create Dynamic Landing Page in WordPress - P1 - Using Meta Box and Elementor
  71. How to Create Dynamic Landing Page in WordPress - P2 - Using Meta Box and Bricks
  72. How to Create Menus for Restaurants - P1 - Using Meta Box and Elementor
  73. How to Create Menus for Restaurants - P2- Using Meta Box and Bricks
  74. How to Create Notification Using Custom HTML Field
  75. How to Create Online Admission Form for School or University
  76. How to Create Online Reservation Form for Restaurants using Meta Box
  77. How to Create Relationships - P1 - Using Meta Box and Oxygen
  78. How to Create Relationships - P2 - Using Meta Box and Bricks
  79. How to Create Relationships - P3 - Using MB Views
  80. How to Create Relationships - P4 - Using Meta Box and Breakdance
  81. How to Create Taxonomy Thumbnails & Featured Images - P2 - Using Meta Box and Oxygen
  82. How to Create Taxonomy Thumbnails & Featured Images - P3 - Using Meta Box and Bricks
  83. How to Create Taxonomy Thumbnails & Featured Images - P4 - Using MB Views
  84. How to Create YouTube Video Timestamps on WordPress Website - P1 - Using MB Views
  85. How to Display a Video Playlist - P1- Using MB Views
  86. How To Display All Listings On A Map With Meta Box
  87. How to Display Author Bio in WordPress - P1 - Using Meta Box and Bricks
  88. How to Display Author Bio in WordPress - P2 - Using MB Views
  89. How to Display Dynamic Banners in WordPress - P3 - Using MB Views
  90. How to Display Images from Cloneable Fields - P1 - with Gutenberg
  91. How to Display Images from Cloneable Fields - P2 - Using Meta Box and Oxygen
  92. How to Display Images from Cloneable Fields - P3 - with Elementor
  93. How to Display Images from Cloneable Fields - P4 - with Bricks
  94. How to Display Opening Hours for Restaurants - P1 - Using Meta Box + Gutenberg
  95. How to Display Opening Hours for Restaurants - P2 - Using Meta Box and Oxygen
  96. How to Display Product Variations - P1 - Using Meta Box and Gutenberg
  97. How to Display Product Variations - P2 - Using Meta Box and Oxygen
  98. How to Display Product Variations - P3 - Using Meta Box and Bricks
  99. How to Display the Dynamic Banners - P2 - Using Meta Box and Bricks

Leave a Reply

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