Created
January 10, 2009 00:37
-
-
Save beastaugh/45330 to your computer and use it in GitHub Desktop.
Add a class of 'page' to the body element on WordPress pages.
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 | |
/* | |
Plugin Name: Classy Pages | |
Plugin URI: http://tarskitheme.com/ | |
Description: Add a class of <code>page</code> to the <code>body</code> element on pages. | |
Author: Benedict Eastaugh | |
Version: 1.0 | |
Author URI: http://extralogical.net/ | |
*/ | |
/** | |
* Adds a class of 'page' to the body element when on a page, and a class of | |
* 'single' when on a single post page. | |
* | |
* @param array $classes | |
* @return array $classes | |
*/ | |
function add_page_class_to_body($classes) { | |
if (is_page()) $classes[] = 'page'; | |
if (is_single()) $classes[] = 'single'; | |
return $classes; | |
} | |
add_filter('tarski_bodyclass', 'add_page_class_to_body'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment