Skip to content

Instantly share code, notes, and snippets.

@Pebblo
Last active September 15, 2021 10:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pebblo/2fe9648492d16108d121311c70235652 to your computer and use it in GitHub Desktop.
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.
<?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);
<?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