Created
July 31, 2017 13:16
-
-
Save Basilakis/de9667b96ae50d7f24b96d7122d52320 to your computer and use it in GitHub Desktop.
Adds a class of "wp_is_mobile" to the body class of the page
This file contains hidden or 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
function add_is_mobile_bodyclass($classes) { | |
//adds a class of "wp_is_mobile" to the body class of the page | |
if (wp_is_mobile()) { | |
$classes[] = 'wp_is_mobile'; | |
} | |
return $classes; | |
} | |
add_filter('body_class','add_is_mobile_bodyclass'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment