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!
[s2If current_user_can(access_s2member_level2) OR current_user_can(access_s2member_ccap_espresso_recurring) OR current_user_can(access_s2member_ccap_vip_membership)]

What will be needed?

  • Event Espresso
  • Recurring Event Manager (REM)
  • Custom Files add on
  • Ability to edit a few files

 

Getting Started

Ok, I am assuming the above plugins have been installed and activated.

Installation

The Custom Files add on is not a plugin and should be unzipped and copied to your uploads/espresso/ directory.


Start by creating some events using REM so that you have the correct number of recurring events that you need.

Create a new WordPress Page, call it what you like, i will call mine dropdown, and add this shortcode into it:

[EVENT_CSS_DROPDOWN]

Feel free to add other text and images as you feel fit.

Now for some minor file modification.

Download the css_dropdown_display.php and css_dropdown.php files from your server and open them in a text editor like Notepad, Notepad++, but not Word or any other WordProcessor!

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 overwite the existing files (or rename those existing files first to keep them as backups)

Now go to the page you made on your site (eg. www.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.

the dropdown menu

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] 

<strong>Example:</strong> [EVENT_CSS_DROPDOWN limit=5 show_recurrence=true category_identifier=your_category_identifier]

Feeling lazy? Need to see the code in action?

Here is a copy of the modified files based on Custom Files 3.1 Download

[/s2If]

[s2If !current_user_can(access_s2member_level1) OR !current_user_can(access_s2member_ccap_vip_membership) OR !current_user_can(access_s2member_ccap_espresso_recurring)]

The page you are trying to access is reserved for Event Espresso licence holders and VIP members. Please purchase a licence, upgrade your support license for Event Espresso, purchase VIP access or log-in. VIP membership does not entitle you to the product download, products must still be purchased as part of a licence or separately. If you think you are receiving this message in error, http://staging.eventespresso.com/contact/contact us.

[/s2If]


Need more help?

  • Browse or search for more information on this topic in our support forums. Customers with an active support license can open a support topic and get help from Event Espresso staff.
  • Have an emergency? Purchase a support token and get expedited one-on-one help!
  • Go back to documentation for Event Espresso
Event Espresso - Staging Server