Last active
September 15, 2021 10:43
-
-
Save Pebblo/2fe9648492d16108d121311c70235652 to your computer and use it in GitHub Desktop.
Remove anchors from EE calendar category filters to prevent themes from forcing the links to scroll.
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 if you alreayd have one. | |
function tw_ee_cal_remove_anchors(){ | |
wp_add_inline_script( | |
'espresso_calendar', | |
'jQuery( \'#ee-category-legend-ul a[href*="#espresso_calendar"]\' ).each(function() { | |
this.href = this.href.split("#")[0]; | |
});' | |
); | |
} | |
add_action( 'wp_enqueue_scripts', 'tw_ee_cal_remove_anchors', 20); |
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 if you alreayd have one. | |
function tw_ee_cal_remove_js_click_events(){ | |
wp_add_inline_script( | |
'espresso_calendar', | |
'jQuery(\'.ee-category a\').off(\'click\');' | |
); | |
} | |
add_action( 'wp_enqueue_scripts', 'tw_ee_cal_remove_js_click_events', 20); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment