-
-
Save pascalmaddin/71f19c5d5fbaa1e53046 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