Skip to content

Instantly share code, notes, and snippets.

@jaredatch
Last active October 10, 2015 20:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaredatch/3746275 to your computer and use it in GitHub Desktop.
Save jaredatch/3746275 to your computer and use it in GitHub Desktop.
Add slug to body class
<?php
/**
* Add slug to body class
*
* @author Jared Atchison
* @link http://jaredatchison.com/code/
* @param array $classes
* @return array
*/
function ja_body_class_slug( $classes ){
global $post;
if ( isset( $post ) )
$classes[] = $post->post_type . '-' . $post->post_name;
return $classes;
}
add_filter( 'body_class', 'ja_body_class_slug' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment