Last active
December 17, 2015 00:29
-
-
Save norcross/5521173 to your computer and use it in GitHub Desktop.
add a body class based on query string
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 string_body_class($classes) { | |
if ( isset($_GET) && isset( $_GET['class'] ) ) : | |
$classes[] = sanitize_html_class( $_GET['class'] ); | |
endif; | |
return $classes; | |
} | |
add_filter('body_class', 'string_body_class'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment