Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Customize the EE4 calendar category legend using bit of inline JavaScript. You can add this code to a custom plugin http://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/ or into your WordPress theme's functions.php file.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
//* The example below moves the 4th category to position 1 and the 3rd category to position 4
function ee_custom_category_legend_order(){
wp_add_inline_script(
'espresso_calendar',
'jQuery( document ).ready(function($) {
var options = $("#ee-category-legend-ul .has-sub");
$( options[ 3 ] ).insertBefore( $(options[ 0 ] ) );
$( options[ 2 ] ).insertAfter( $(options[ 3 ] ) );
} );'
);
}
add_action( 'wp_enqueue_scripts', 'ee_custom_category_legend_order', 11 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.