Event posts grouped by Month

For Advanced Views Pro users to help you through step-by-step on how to display events or posts grouped by the date field.

In this example

We'll take a list of company employees, and display them in alphabetical order with the Last name in Ascending order, and include a line with first letter of the last name.

Step by step guide

  1. First create your Field Group with the fields, in this case it's Event Date (date) assigned to a Custom Post Type (CPT) called Events.

  2. Visit the Advanced Views tab in WordPress backend.

Create your Layout

  1. Click the Add New Layout button to add a new Layout then Enter a Name for your Layout.

  2. Click the Add Field button in the Assign Fields section. Then select the target Group from the list and the Field from the dropdown. Continue to Add Fields that should be included. in our case we're only adding two fields, Title with Link and Date.

  1. Click on the Publish button to save and publish your Layout.

Create your Post Selection

  1. Use the "Add new" button under 'Assigned to Post Selections' in the right sidebar of your Layout, or Simply go to the Post Selections top tab.

  2. Click the Add New Post Selection button to add a new Post Selection, then enter a Name for your item.

  3. On the General tab choose Item Layout 'event', select Post Type Event, for Sort by "Meta value", with the Sort by Meta Field Group the one containing the date field, in our case it's 'Date(ACF)'. Then for Sort by Meta Field select 'Date (date_picker)' with Sort order "Ascending" i.e. alphabetical (This is important otherwise the grouping won't work correctly).

  1. Switch to Advanced tab and scroll down to Custom Data (Pro) and insert the function snippet below. Replace your field name for "date".

  1. Switch to the Template tab, and copy your Default template content into the Custom template field below it.

Modifying from line 4 -> 18.

  1. Publish or Save your Post Selection and copy the shortcode into place.

Remember to create your event posts and fill out some information in the fields.

Last updated