Skip to content

Instantly share code, notes, and snippets.

@webaware
Created November 28, 2013 09:27
Show Gist options
  • Save webaware/7689334 to your computer and use it in GitHub Desktop.
Save webaware/7689334 to your computer and use it in GitHub Desktop.
quick WordPress snippet for showing what classes have been added to the HTML and BODY elements -- useful for seeing what a tablet or phone gets without messing around with debuggers.
<?php
add_action('wp_print_footer_scripts', function() {
?>
<script>
(function() {
var p = document.createElement("p");
p.appendChild(document.createTextNode("html classes: " + document.documentElement.className));
document.body.appendChild(p);
p = document.createElement("p");
p.appendChild(document.createTextNode("body classes: " + document.body.className));
document.body.appendChild(p);
})();
</script>
<?php
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment