Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.