Select Page

Self-Expiring Custom Post Types

, ,
Self-Expiring Custom Post Types

A new website called for a simple event booking request system. The organization required that each booking request was manually processed by the agent responsible for the region, so seat inventory functions were not required, but they wanted a system that integrated with WordPress and was simple to keep up. Additionally, each listing needed to self-expire before the event date.

A simple WordPress plugin that allows posts and pages to revert to draft mode or to delete themselves was the first part of the puzzle. The listings themselves needed to be organized by Country, and both the Country and Cities listed needed to self-expire so that Countries with no current listings do not show up at all.

WordPress’ custom Post Types was the perfect solution. I created a Post Type for Cities and one for Countries, and attached the city type as a child of the Country Type.

City Custom Post Type

The WordPress interface for City Events

The City Event Type allows for the entry of the City Names, Event Start and End dates, a textual representation of the dates and includes additional fields to support displaying the listing in many different formats.

The procedure for entering a new event or editing an exiting event is simple: just open up the country listing and add a new City event or edit an existing event. Simple, quick and accurate!

A series of shortcodes was created to display the custom data in different formats. Here’s one of the listing layouts:

City Event Listing

 

Skills

, , ,

Posted on

October 26, 2014