Skip to content

Instantly share code, notes, and snippets.

@Basilakis
Created July 31, 2017 13:16
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 Basilakis/de9667b96ae50d7f24b96d7122d52320 to your computer and use it in GitHub Desktop.
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
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