How to use the Custom Files to Create a Drop Down List of Recurring Events
This basic tutorial will show you how to create a dropdown menu for your recurring events. It can quite easily be used for your standard events as well!
What will be needed?
- Event Espresso
- Recurring Event Manager (REM) add-on
- Custom Files add-on
- Ability to edit a few files
Getting Started
The plugins above should be installed and activated.
The Custom Files add-on is not a plugin and should be unzipped and copied to your uploads/espresso/ directory using your preferred SFTP or FTP client. Cyberduck and FileZilla are two free options.
Start by creating some events using REM so that you have the correct number of recurring events that you need.
Next, create a new WordPress Page and add the following shortcode to it:
[EVENT_CSS_DROPDOWN]
Feel free to add other text and images as you feel fit.
Now we need to modify some files.
Download the css_dropdown_display.php and css_dropdown.php files from your server and open them in a text editor like Notepad, Notepad++ (not Word or any other Word Processor program)
css_dropdown_display.php
There’s not much in this file which is great.
<a title="<?php echo stripslashes_deep($event_name)?>" class="a_event_title" id="a_event_title-<?php echo $event_id?>" href="<?php echo $registration_url; ?>"><?php echo stripslashes_deep($event_name)?></a>
Change it to
<a id="a_event_title-<?php echo $event_id?>" class="a_event_title" title="<?php echo stripslashes_deep($event_name)?>" href="<?php echo $registration_url; ?>"><!--?php echo stripslashes_deep($event_name)?--> - <!--?php echo $start_date; ?--></a>
This will add the start date to the end of the events so you can tell them apart.
css_dropdown.php
A little bit more code here but the change we will make is really easy. On line 37 you will see this
extract(shortcode_atts(array('category_identifier' => 'NULL','show_expired' =>; 'false', 'show_secondary'=>'false','show_deleted'=>'false','show_recurrence'=>'false', 'limit' =>; '0', 'order_by' => 'NULL', 'template_name'=>'css_dropdown_display', 'button_text'=>'Choose an Event'),$atts));
Where it says
'show_recurrence'=>'false'
change it to say
'show_recurrence'=>'true'
Save these files and upload them to uploads/espresso/templates/css-dropdown and overwrite the existing files (or rename those existing files first to keep them as backups)
Now go to the page you made on your site (e.g. yoursite.com/dropdown) and you will see the drop down menu. Clicking it will show your recurring events with their start date and clicking one will take you to the events registration page.
Shortcode Attributes
[EVENT_CSS_DROPDOWN] [EVENT_CSS_DROPDOWN limit=1] [EVENT_CSS_DROPDOWN show_expired=true] [EVENT_CSS_DROPDOWN show_deleted=true] [EVENT_CSS_DROPDOWN show_secondary=true] [EVENT_CSS_DROPDOWN show_recurrence=true] [EVENT_CSS_DROPDOWN category_identifier=your_category_identifier] [EVENT_CSS_DROPDOWN limit=5 show_recurrence=true category_identifier=your_category_identifier]
Need to see the code in action?
Here is a copy of the modified files based on Custom Files 3.1 Download