Support

Home Forums Events Calendar Add-on EE3 Calendar Add-On: Reorder Category Filter list

EE3 Calendar Add-On: Reorder Category Filter list

Posted: June 4, 2015 at 2:50 pm

Viewing 6 reply threads


Trevis

June 4, 2015 at 2:50 pm

Is it possible to change the order of the categories in the filter dropdown on the calendar? I changed the category IDs in the database to represent the order I’d like, thinking that would affect the order but, no luck.

Thanks!


Lorenzo Orlando Caum

  • Support Staff

June 4, 2015 at 4:55 pm

Hi Trevis, any available options for the calendar are already shown in the calendar settings area in your WP dashboard. Note that the calendar does not use templates so changing the default behavior isn’t as easy as changing something within a template for a page in Event Espresso 3.

You could check with an Event Espresso professional here for help on adding this new feature for adjusting the order of the options in the dropdown menu:

https://eventespresso.com/developers/event-espresso-pros/


Lorenzo


Trevis

June 4, 2015 at 5:51 pm

Bummer.


Josh

  • Support Staff

June 4, 2015 at 6:54 pm

Hi Trevis,

There’s another way to reorder those. Since the Calendar page is loading the jQuery library, you can add a little jQuery to the bottom of the calendar page. Here’s a little example you can use, which shows how to move the 3rd option up to right after the Select All option:

var options = jQuery('.ee-category-select option'); 
jQuery( options[ 4 ] ).insertAfter( jQuery(options[ 1 ] ) );


Trevis

June 5, 2015 at 5:20 pm

Thanks for the suggestion, Josh. When I add the jQuery example to the bottom of the espresso-calendar.php file and reload the site, it returns a blank, white page. Is there a more specific place I should add that?

Here’s a link to the resulting code: http://hastebin.com/rocusilace.php


Josh

  • Support Staff

June 6, 2015 at 9:26 am

Yes, you should definetly not add this to the calendar plugin code. Instead, you can add it to your theme’s functions.php file or into a site specific snippets plugin.

Here’s a more verbose example that shows how to add the custom script via a custom function:

function eecal_print_my_inline_script() {
  if( is_page('calendar' ) ){ //substitute 'calendar' with your calendar page's slug
    if ( wp_script_is( 'jquery', 'done' ) ) {
?>
<script type="text/javascript">
jQuery(document).ready(function($){
	var options = $('.ee-category-select option'); 
	$( options[ 4 ] ).insertAfter( $(options[ 1 ] ) );
  // add more here
});
</script>
<?php
    }
  }
}
add_action( 'wp_footer', 'eecal_print_my_inline_script' );


Trevis

June 6, 2015 at 6:32 pm

Thank you so much, Josh—that works perfectly. I greatly appreciate the help!

Viewing 6 reply threads

The support post ‘EE3 Calendar Add-On: Reorder Category Filter list’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso