Sharing what’s coming up helps us see important dates and deadlines, so we can manage events better. Take the upcoming events as an example. Let's use Meta Box and Bricks to make it happen!

Show the upcoming events section using Meta Box and Bricks

Video Version

Before Getting Started

This is the rule: just events with the end date after the current day could be displayed in the section. Day by day, if it passes the end date of any event, those events will automatically disappear from the page.

Assume that today is December 8th.

Assume that today is December 8th.

We will filter and display the events that are either ongoing or scheduled for the future. This means that an event with an end date beyond December 8th will be shown on the page.

An event with an end date beyond December 8th will be shown on the page.

For some basic event details, I’ll create some custom fields. The start date and the end date as well as will be used for that filter. And in this case, each event will be a post of a custom post type.

Here's what we'll use:

And, I use Bricks to build the page.

Now, let’s start!

Create a New Post Type

Go to Meta Box > Post Types to create a new post type for the events.

Create a new post type for the events.

After publishing, you’ll see a new menu. It’s your post type.

A new menu in the dashboard

Create Custom Fields

Each event may have some subsidiary information. Then, we should use custom fields to store them. I have some typical ones for this practice.

Some typical custom fields to store event information

Two of them, the start date and end date should be must-have items since they will be used for the filter.

Now, go to Meta Box > Custom Fields to create them.

Go to Meta Box > Custom Fields to create fields

Choose the Date Picker field type for the start and end date of the event.

Choose the Date Picker field type for the start and end date of the event.

To display the date on the management dashboard for easy comparison with the results, turn on the button like in the image below. This setting is available only when enabling the MB Admin Columns extension. This extension is just optional, so I did not mention it at the beginning.

Turn on the button to show the date on the management dashboard

After creating all the needed fields, go to the Settings tab > choose Location as Post type > select Event to apply these fields to this post type.

Set the location to apply these fields to the Event post type

Now, in the post editor, you will see the created custom fields.

The created custom fields in the post editor

Just input data into them.

Here are some posts that I created for example:

Some posts that I created for example

The start date and the end date are shown as admin columns. You may want to see these ones once again in the end to easily compare with the ones displayed on the page.

Display All Events on the Page

Now, choose a place then edit a page with Bricks to add the section. I will display all the events along with their information first.

First, select a Section element.

Select a Section element.

Next, add a Heading element, and name the title.

Add a Heading element, and name the title

In the Container element inside the section, select the Div element to contain the event’s information.

Select the Div element to contain the event’s information.

Then, to get all posts in the Event post type, enable the Use query loop button. In the Query section, choose the Type as Posts. And, choose the post type you want to get data from in the Post type section.

Set condition to get all posts in the Event post type

Now, let’s add some elements to get detailed information of the events.

For the image of the event, choose the Image element. Since these images are the featured image of the post, click the Select dynamic data icon and choose the Featured Image option.

Get the image of the event

As you can see, the image is displayed in the preview.

The image is displayed in the preview

Next, add the Post Title element for the event title.

Add the Post Title element for the event title

Now, I want to display the start date, end date, and location along with icons, so choose the Icon Box element instead of normal text.

Choose Icon Box element to display the start date, end date and location along with icons

You can style, and choose any icon as you want.

You can style and choose the icon as you want.

As this information is saved in custom fields created with Meta Box, we’ll use the Select dynamic data, and then choose the corresponding fields.

Use the Select dynamic data, and then choose the corresponding fields

As a result, you’ll see a date from the Start Date field displayed immediately.

A date from the Start Date field displayed immediately

Do the same with the end date and location. Just duplicate the Icon Box element for saving time, then change the corresponding information.

We’ve just finished getting all the posts in the event post type. Note that I specifically mentioned "all the posts".

All the posts in the event post type display

To style this section, choose each element and change its settings.

Look at this picture, you can see all the events shown on the frontend with styling.

All the events shown on the frontend with styling

To display only the upcoming events, we need a custom query to filter those posts. Let’s move to the next step.

Query to Show the Upcoming Events

It’s great when Bricks supports creating any custom query on the screen. So in the page editor with Bricks, go back to the Query section of the div, look for the Meta Query section, and add a meta query.

In the Query section of the div, look for the Meta Query section, and add a meta query.

We should compare the end date with the current date. If the events have the end date after the current date, they could be displayed. Let’s set the condition like this:

Set condition to display the upcoming event

In there:

  • In the Meta key box, enter the ID of the field named End Date.
  • In the Meta Value box, add the current date with the {current_date:Y-m-d} format.
  • In the Compare box, choose the Greater than or equal option to get the events that have the end date after the current date.

That’s all for the condition!

On the frontend, just events have the end date after the current day, which I marked at the beginning could be displayed.

Just events have the end date after the current day

Last Words

We've walked through all the necessary steps to show upcoming events using Meta Box and Bricks. If you use other page builders, keep an eye on our series for future guides.

Should you need to display posts with additional specific criteria, you can refer to it. Hope it can be helpful to you!

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 Reading Progress Bar in WordPress Posts - P1 - Using MB Views
  31. How to Create a Recipe - P2 - Using Meta Box and Oxygen
  32. How to Create a Recipe - P3 - Using Meta Box and Elementor
  33. How to Create a Recipe - P4 - Using Meta Box and Bricks
  34. How to Create a Recipe - P5 - Using Meta Box and Zion
  35. How to Create a Recipe - P6 - Using Meta Box and Brizy
  36. How to Create a Recipe - P7 - Using Meta Box and Breakdance
  37. How to Create a Recipe - P8 - Using Meta Box and Kadence
  38. How to Create a Recipe - P9 - Using Meta Box and Divi
  39. How to Create a Recipe with Meta Box Plugin
  40. How to Create a Simple Listing - P2 - Using Meta Box and Bricks
  41. How to Create a Simple Listing - P3 - Using Meta Box and Breakdance
  42. How to Create a Simple Listing - P4 - Using Meta Box and Elementor
  43. How to Create a Simple Listing - P5 - Using Meta Box and Kadence
  44. How to Create a Team Members Page - P1- Using Meta Box and Elementor
  45. How to Create a Team Members Page - P2 - Using Meta Box and Oxygen
  46. How to Create a Team Members Page - P3 - Using Meta Box and Bricks
  47. How to Create a Team Members Page - P4 - Just Meta Box
  48. How to Create a Team Members Page - P6 - using Meta Box and Breakdance
  49. How to Create a Team Members Page - P7 - Using Meta Box and Kadence
  50. How to Create a Video Gallery Page - P2 - Using Meta Box + Bricks
  51. How to Create a Video Gallery Page - P3 - Using Meta Box and Breakdance
  52. How to Create a Video Gallery Page - P4 - Using Meta Box + Elementor
  53. How to Create a Video Gallery Page - P5 - Using MB Views
  54. How to Create a Video Gallery Page - P6 - Using Meta Box and Zion
  55. How to Create a Video Gallery Page - P7 - Using Meta Box and Kadence
  56. How to Create a Video Gallery Page Using Meta Box + Oxygen
  57. How to Create ACF Flexible Content Field with Meta Box
  58. How to Create an Auto-Updated Cheat Sheet in WordPress
  59. How to Create an FAQs Page - P1 - Using Meta Box and Elementor
  60. How to create an FAQs page - P2 - Using Meta Box and Oxygen
  61. How to create an FAQs page - P4 - Using Meta Box and Bricks
  62. How to Create an FAQs Page - P6 - Using MB Views
  63. How to Create an FAQs Page - P7 - Using Meta Box and Divi
  64. How to Create an FAQs Page - P8 - Using Meta Box and Kadence
  65. How to Create an FAQs Page - P9 - Using MB Blocks
  66. How to Create an FAQs Page -P3- Using Meta Box
  67. How to Create Buttons with Dynamic Link using Custom Fields
  68. How to Create Category Thumbnails & Featured Images Using Custom Fields
  69. How to Create Download and Preview Buttons - P1 - Using Meta Box and Bricks
  70. How to Create Download and Preview Buttons - P2 - Using Meta Box and Oxygen
  71. How to Create Download and Preview Buttons - P3 - Using MB Views
  72. How to Create Download and Preview Buttons - P4 - Using Meta Box and Kadence
  73. How to Create Download Buttons in WordPress - Using Custom Fields
  74. How to Create Dynamic Landing Page in WordPress - P1 - Using Meta Box and Elementor
  75. How to Create Dynamic Landing Page in WordPress - P2 - Using Meta Box and Bricks
  76. How to Create Menus for Restaurants - P1 - Using Meta Box and Elementor
  77. How to Create Menus for Restaurants - P2- Using Meta Box and Bricks
  78. How to Create Notification Using Custom HTML Field
  79. How to Create Online Admission Form for School or University
  80. How to Create Online Reservation Form for Restaurants using Meta Box
  81. How to Create Reading Time to Your WordPress Posts - Using MB Views
  82. How to Create Relationships - P1 - Using Meta Box and Oxygen
  83. How to Create Relationships - P2 - Using Meta Box and Bricks
  84. How to Create Relationships - P3 - Using MB Views
  85. How to Create Relationships - P4 - Using Meta Box and Breakdance
  86. How to Create Taxonomy Thumbnails & Featured Images - P2 - Using Meta Box and Oxygen
  87. How to Create Taxonomy Thumbnails & Featured Images - P3 - Using Meta Box and Bricks
  88. How to Create Taxonomy Thumbnails & Featured Images - P4 - Using MB Views
  89. How to Create YouTube Video Timestamps on WordPress Website - P1 - Using MB Views
  90. How to Display a Video Playlist - P1- Using MB Views
  91. How To Display All Listings On A Map With Meta Box
  92. How to Display Author Bio in WordPress - P1 - Using Meta Box and Bricks
  93. How to Display Author Bio in WordPress - P2 - Using MB Views
  94. How to Display Dynamic Banners in WordPress - P3 - Using MB Views
  95. How to Display Images from Cloneable Fields - P1 - with Gutenberg
  96. How to Display Images from Cloneable Fields - P2 - Using Meta Box and Oxygen
  97. How to Display Images from Cloneable Fields - P3 - with Elementor
  98. How to Display Images from Cloneable Fields - P4 - with Bricks
  99. How to Display Opening Hours for Restaurants - P1 - Using Meta Box + Gutenberg

Leave a Reply

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