Skip to content

Instantly share code, notes, and snippets.

@norcross
Last active December 17, 2015 00:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save norcross/5521173 to your computer and use it in GitHub Desktop.
Save norcross/5521173 to your computer and use it in GitHub Desktop.
add a body class based on query string
<?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