Skip to content

Instantly share code, notes, and snippets.

@ckpicker
Created July 14, 2014 14:58
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 ckpicker/10293ac66a9486c99fa2 to your computer and use it in GitHub Desktop.
Save ckpicker/10293ac66a9486c99fa2 to your computer and use it in GitHub Desktop.
Events Calendar 3.6.1 // Disable Mobile Media Queries when Printing
add_filter( 'style_loader_tag', 'tribe_add_screen_to_mobile_css', 100, 2);
function tribe_add_screen_to_mobile_css( $style_tag ) {
//Grab style tag as XML element
$customXML = new SimpleXMLElement($style_tag);
$id = (string)$customXML->attributes()->id;
//If adding the mobile stylesheet
if ( $id == 'tribe-events-calendar-mobile-style-css' || $id == 'tribe-events-calendar-full-mobile-style-css' || $id == 'tribe-events-calendar-full-pro-mobile-style-css' || $id == 'tribe-events-calendar-pro-mobile-style-css' ) {
$media = (string)$customXML->attributes()->media;
//Replace the media attribute and specify for screen display only
$customXML->attributes()->media = 'only screen and ' . $media;
return $customXML->asXML();
} else {
return $style_tag;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment