-
-
Save cdils/8539634 to your computer and use it in GitHub Desktop.
Strip "color" id/value from querystring and use as body class. Prepends "theme-prefix-" to the color name. Example: For http://www.example.com/?color=blue the class would be "theme-prefix-blue."
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 //remove opening tag | |
add_filter('body_class', 'string_body_class'); | |
function string_body_class( $classes ) { | |
if ( isset( $_GET['color'] ) ) : | |
$classes[] = 'theme-prefix-' . sanitize_html_class( $_GET['color'] ); | |
endif; | |
return $classes; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment