Created
July 14, 2014 14:58
-
-
Save ckpicker/10293ac66a9486c99fa2 to your computer and use it in GitHub Desktop.
Events Calendar 3.6.1 // Disable Mobile Media Queries when Printing
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
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