Skip to content

Instantly share code, notes, and snippets.

@jaredatch
Last active January 3, 2016 22:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaredatch/8531535 to your computer and use it in GitHub Desktop.
Save jaredatch/8531535 to your computer and use it in GitHub Desktop.
<?php
/**
* Uses a query string (color) to apply a body class.
*
* @param array $classes
* @return array
*/
function ja_dynamic_body_class( $classes ){
if ( empty( $_GET['color'] )
return $classes;
$classes[] = 'my-theme-' . esc_attr( $_GET['color'] );
return $classes;
}
add_filter( 'body_class', 'ja_dynamic_body_class' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment