Skip to content
This repository has been archived by the owner on May 20, 2021. It is now read-only.

Commit

Permalink
Add page name to body class.
Browse files Browse the repository at this point in the history
  • Loading branch information
mindctrl committed Aug 12, 2014
1 parent d11a52b commit 2b02451
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion inc/tweaks.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,21 @@ function alienship_setup_author() {
$GLOBALS['authordata'] = get_userdata( $wp_query->post->post_author );
}
}
add_action( 'wp', 'alienship_setup_author' );
add_action( 'wp', 'alienship_setup_author' );



/**
* Adds the page name to the body class.
* Used for targeting CSS.
*/
function alienship_body_class( $classes ) {

if( ! is_page() )
return $classes;

global $post;
$classes[] = $post->post_name;
return $classes;
}
add_filter( 'body_class', 'alienship_body_class' );

0 comments on commit 2b02451

Please sign in to comment.