Last active
January 3, 2016 22:59
-
-
Save jaredatch/8531535 to your computer and use it in GitHub Desktop.
This file contains 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 | |
/** | |
* 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