GD > Event Schedules
All Widgets come as Widgets, Shortcodes or Blocks. Learn more about our Super Duper Widgets.
The Event Schedules widget displays the event schedules on the frontend. It works with the Events CPT provided by the Events Manager extension, as well as any other CPT that you might assign as an Events CPT.
In order to use the Events Calendar, you need to have the Events extension installed and activated.
How it Works?
Events Schedules provides one Super Duper widget -- that can be used as a widget, shortcode or block. You can choose to use any Events CPT with the Event Schedules widget, as well as customize its features or options such as the start day of the week in month-view.
Widget Options
- Title - The title for the widget.
- Post ID (A) - Specify the event post ID for which schedules is to be shown. If left blank, the current post ID will be used.
- Event Type - Choose the type of events to display. For instance, you may choose to show only upcoming events, or only past events, or events for the next week or month, and so on.
- Number of Schedules to Show (A) - You can specify the total number of schedules to be shown.
- Date Format (A) - Specify the date format.
- Time Format (A) - Specify the time format.
- Schedule Template (A) - You can choose the schedule display template.
- Tick to use current schedule date to get schedules if schedule is already set on event listings (Checkbox) (A) - If checked, the widget looks for the schedule date in the event CPT. If it has a schedule set, then it will use that schedule to find next schedules.
- Tick to hide current schedule date in schedules on event listings (Checkbox) (A) - If checked, the current schedule will not be shown the list of schedules.
- Show/Hide Options - Choose where the widget should be shown. You can choose to display it:
- Everywhere,
- Only on GeoDirectory pages,
- Only on specific pages,
- Everywhere excluding certain specific pages.
Example Output
Default output, with schedule date and time:
Customizing GD > Event Schedules
It is possible to create new schedule templates using code snippets like this:
function gd_snippet_get_schedule_templates( $templates ) { $templates[] = '{start_date} . {start_time}'; return $templates; } add_filter( 'geodir_event_get_schedule_templates', 'gd_snippet_get_schedule_templates', 10, 1 );
Here is an example implementation
Use shortcode in archive item template:[geodir_event_schedules type="upcoming" number="1" use_current="1"]
Add this snippet:
function gd_snippet_schedule_parse_template( $content, $item, $schedule, $template, $date_format, $time_format ) { $start_date_strtotime = strtotime( $schedule->start_date ); $content = '<div class="_geodir-wrap"><div class="_geodir-start-M">' . date_i18n( 'M', $start_date_strtotime ) . '</div><div class="_geodir-start-j">' . date_i18n( 'j', $start_date_strtotime ) . '</div><div class="_geodir-start-D">' . date_i18n( 'D', $start_date_strtotime ) . '</div></div>'; return $content; } add_filter( 'geodir_event_widget_schedules_parse_template', 'gd_snippet_schedule_parse_template', 10, 6 );