Last active
September 13, 2016 19:25
-
-
Save cliffordp/1d39d2f51b82c0077212472d498873dd to your computer and use it in GitHub Desktop.
The Events Calendar: Override TEC's own JS override of Month view's iCal export (forcing Month export) -- so we can ACTUALLY use the https://gist.github.com/cliffordp/ab1f7c4d95723ee6f892 snippet
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 | |
/** | |
* From https://gist.github.com/cliffordp/1d39d2f51b82c0077212472d498873dd | |
* | |
* The Events Calendar: Override TEC's own JS override of Month view's iCal export (forcing Month export) -- so we can ACTUALLY use the https://gist.github.com/cliffordp/ab1f7c4d95723ee6f892 snippet | |
* | |
* Updated 2016-09-13 to not overwrite iCal Export links on Single Event view (and potentially elsewhere) | |
*/ | |
function cliff_tec_month_ical_year_link_strong_override() { | |
if ( ! class_exists( 'Tribe__Events__Main' ) ) { | |
return false; | |
} | |
$tecmain = Tribe__Events__Main::instance(); | |
// https://developer.wordpress.org/reference/functions/is_post_type_archive/ | |
if ( ! is_post_type_archive( $tecmain::POSTTYPE ) ) { | |
return false; | |
} | |
wp_enqueue_script( 'jquery' ); | |
?> | |
<script type="text/javascript"> | |
jQuery(document).ready( function () { | |
jQuery( 'a.tribe-events-ical.tribe-events-button' ).attr( 'href', '/events/?ical=1&year-feed' ); | |
}); | |
</script> | |
<?php | |
} | |
add_action( 'wp_head', 'cliff_tec_month_ical_year_link_strong_override' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment