Skip to content

Instantly share code, notes, and snippets.

@joshfeck
Created February 8, 2017 21:06
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 joshfeck/6b8cc1d4d783c599eeda6f8af2ec9c89 to your computer and use it in GitHub Desktop.
Save joshfeck/6b8cc1d4d783c599eeda6f8af2ec9c89 to your computer and use it in GitHub Desktop.
EE4 Calendar: Open event links in a new window/tab.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
function eecal_custom_calendar_open_events_new_tab(){
wp_add_inline_script(
'espresso_calendar',
'jQuery( document ).ready(function($) {
$( document ).ajaxComplete(function() {
$("#espresso_calendar a.fc-event").attr("target", "_blank");
$( "#espresso_calendar .fc-event" )
.mouseover(function() {
$(".reg-now-btn").attr("target", "_blank");
} )
} );
} );'
);
}
add_action( 'wp_enqueue_scripts', 'eecal_custom_calendar_open_events_new_tab', 11 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment