Title: Switch between time scopes
Last modified: August 20, 2016

---

# Switch between time scopes

 *  Resolved [ninetienne](https://wordpress.org/support/users/ninetienne/)
 * (@ninetienne)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/switch-between-time-scopes/)
 * First of all thank you for the great plugin!
 * I would like the user to be able to choose the time scope instead of using search
   on the events page. There shall be scopes like “today”, “tomorrow”, “this weekend”,“
   this week”.
 * Example: [http://london.lecool.com/london/en/weekend](http://london.lecool.com/london/en/weekend)
   
   You can choose what events to display depanding on the time span: today, weekend,
   this week.
 * Is there an easy way I can add such filter option to the events page?
 * Thank you.

Viewing 14 replies - 1 through 14 (of 14 total)

 *  [agelonwl](https://wordpress.org/support/users/angelonwl/)
 * (@angelonwl)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/switch-between-time-scopes/#post-2133277)
 * hello,
 * please try checking EventsManager Docs @
 * [http://wp-events-plugin.com/documentation/shortcodes/](http://wp-events-plugin.com/documentation/shortcodes/)
 * and
 * [http://wp-events-plugin.com/documentation/event-search-attributes/](http://wp-events-plugin.com/documentation/event-search-attributes/)
 *  Thread Starter [ninetienne](https://wordpress.org/support/users/ninetienne/)
 * (@ninetienne)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/switch-between-time-scopes/#post-2133280)
 * Thank you for your quick response!
 * Luckily I managed to implement the filter. Here’s the code, in case anyone will
   need it:
 *     ```
       <!-- START Time Scope -->
       		<?php foreach( em_get_scopes() as $key => $value) : ?>
       		<label><input type="radio" name="scope" value='<?php echo $key ?>' /><?php echo $value; ?></label>
       		<?php endforeach; ?>
               <!-- END Time Scope -->
               <hr style="float: left; clear: both; width: 100%; color: #666; margin: 10px 0;" noshade="noshade"/>
       		<!-- START Category Search -->
       		<label><input name="category" type="radio" value="" />Все</label>
               <?php foreach(EM_Categories::get(array('orderby'=>'category_name')) as $EM_Category): ?>
       		<label><input name="category" type="radio" value="<?php echo $EM_Category->id; ?>" /><?php echo $EM_Category->name; ?></label>
       		<?php endforeach; ?>
       		<!-- END Category Search -->
       ```
   
 *  Thread Starter [ninetienne](https://wordpress.org/support/users/ninetienne/)
 * (@ninetienne)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/switch-between-time-scopes/#post-2133281)
 * One note though:
 * How can I make the radio boxes “checked” on the results page?
 *  [agelonwl](https://wordpress.org/support/users/angelonwl/)
 * (@angelonwl)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/switch-between-time-scopes/#post-2133290)
 * try this:
 * `echo (condition) ? 'checked="checked"':''`
 *  Thread Starter [ninetienne](https://wordpress.org/support/users/ninetienne/)
 * (@ninetienne)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/switch-between-time-scopes/#post-2133294)
 * I added the code and now I have:
    `<label><input type="radio" name="scope" value
   ='<?php echo $key ?>' <?php echo (condition) ? 'checked="checked"':'' ?>/><?php
   echo $value; ?></label>` However the checked radio is always the last one, no
   matter what I select. Shall I change `condition` to something else?
 *  [agelonwl](https://wordpress.org/support/users/angelonwl/)
 * (@angelonwl)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/switch-between-time-scopes/#post-2133299)
 * yes. change the condition based on the criteria you wanted like
    example:
 * `echo ($category_name == 'Rock') ? 'checked="checked"': '' ;`
    |_____________________________________________
   | |_| if else
 *  Thread Starter [ninetienne](https://wordpress.org/support/users/ninetienne/)
 * (@ninetienne)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/switch-between-time-scopes/#post-2133301)
 * Thank you for trying to help me.
 * However I am not aware of the condition for the active category or time scope.
 * I would like to user to:
    1. land on the main events page
    2. check the desired filter options by clicking on radio buttons
    3. land on the results page with those filter options checked which the client 
       selected one step ealier.
 * Could you please give a hint how it can be done. Many thanks!
 *  Thread Starter [ninetienne](https://wordpress.org/support/users/ninetienne/)
 * (@ninetienne)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/switch-between-time-scopes/#post-2133305)
 * OK, I managed to get it for categories.
 * Thank you very much!
 * Here’s the code:
 *     ```
       <label><input name="category" type="radio" value="" <?php echo (empty($_REQUEST['category'])) ? 'checked="checked"':''; ?>/>Все</label>
               <?php foreach(EM_Categories::get(array('orderby'=>'category_name')) as $EM_Category): ?>
       		<label><input name="category" type="radio" value="<?php echo $EM_Category->id; ?>" <?php echo (!empty($_REQUEST['category']) && $_REQUEST['category'] == $EM_Category->id) ? 'checked="checked"':''; ?>/><?php echo $EM_Category->name; ?></label>
       		<?php endforeach; ?>
       ```
   
 * However I can not get it for the time scope with the code:
 *     ```
       <?php foreach( em_get_scopes() as $key => $value) : ?>
       		<label><input type="radio" name="scope" value='<?php echo $key ?>' <?php echo (!empty($_REQUEST['scope']) && $_REQUEST['scope'] == $EM_Scope->id) ? 'checked="checked"':''; ?>/><?php echo $value; ?></label>
       		<?php endforeach; ?>
       ```
   
 * I assume there is no `$EM_Scope->id`.
 * What is wrong with my code?
 *  [agelonwl](https://wordpress.org/support/users/angelonwl/)
 * (@angelonwl)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/switch-between-time-scopes/#post-2133310)
 * i think you’re getting too far! can you try this docs:
 * [http://wp-events-plugin.com/documentation/shortcodes/](http://wp-events-plugin.com/documentation/shortcodes/)
 * and
 * [http://wp-events-plugin.com/documentation/event-search-attributes/](http://wp-events-plugin.com/documentation/event-search-attributes/)
 *  [agelonwl](https://wordpress.org/support/users/angelonwl/)
 * (@angelonwl)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/switch-between-time-scopes/#post-2133311)
 * EM has alot of shortcodes which maybe you can use
 *  Thread Starter [ninetienne](https://wordpress.org/support/users/ninetienne/)
 * (@ninetienne)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/switch-between-time-scopes/#post-2133312)
 * I’m not getting too far.
 * In your basic installation when you choose start and end date for the search 
   form — the fields are blank on the results page.
 * However – from the usability point of view – they shall not be empty! The user
   shall see what dates apply to the list of given events.
 * How can you display the actual dates on the results page?
 *  [agelonwl](https://wordpress.org/support/users/angelonwl/)
 * (@angelonwl)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/switch-between-time-scopes/#post-2133339)
 * @ the events-manager plugin folder there’s a template folder which you can copy
   at your theme folder like mytheme->plugins(add this folder if not existing)->
   events-manager->templates
 * then you can modify EM looks like events-search..
 * for full info. visit [http://wp-events-plugin.com/documentation/using-template-files/](http://wp-events-plugin.com/documentation/using-template-files/)
 *  [agelonwl](https://wordpress.org/support/users/angelonwl/)
 * (@angelonwl)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/switch-between-time-scopes/#post-2133341)
 * for the date @ search page you can add php date format yyyy-m-d
 * add that php date to the events-search at template line
 *     ```
       <input type="text" id="em-date-start-loc"  value="current_date_here" />
       or
       <input type="text" id="em-date-end-loc"  value="current_date_here" />
       ```
   
 *  Plugin Author [Marcus (aka @msykes)](https://wordpress.org/support/users/netweblogic/)
 * (@netweblogic)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/switch-between-time-scopes/#post-2133564)
 * angelo’s last suggestion is correct, you need to use template files so it’s upgrade
   safe and modify the search form to your needs. You can feed a select box with
   name scope instead of the dates and that’d be like using search arguments to 
   feed a scope name e.g. today/tomorrow etc.

Viewing 14 replies - 1 through 14 (of 14 total)

The topic ‘Switch between time scopes’ is closed to new replies.

 * ![](https://ps.w.org/events-manager/assets/icon-256x256.png?rev=1039078)
 * [Events Manager - Calendar, Bookings, Tickets, and more!](https://wordpress.org/plugins/events-manager/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/events-manager/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/events-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/events-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/events-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/events-manager/reviews/)

 * 14 replies
 * 3 participants
 * Last reply from: [Marcus (aka @msykes)](https://wordpress.org/support/users/netweblogic/)
 * Last activity: [14 years, 11 months ago](https://wordpress.org/support/topic/switch-between-time-scopes/#post-2133564)
 * Status: resolved