Created
December 1, 2016 18:13
-
-
Save joshfeck/caf106f86444cca8cefab74160ea5452 to your computer and use it in GitHub Desktop.
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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