Created
November 10, 2015 10:28
-
-
Save walterebert/8a89e06c68b5387b5772 to your computer and use it in GitHub Desktop.
WordPress snippet: Add mobile CSS class
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
<?php | |
function my_body_class( $classes ) { | |
if ( wp_is_mobile() ) { | |
$classes[] = 'is-mobile'; | |
} | |
return $classes; | |
} | |
add_filter( 'body_class', 'my_body_class' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment