Created
September 1, 2012 02:49
-
-
Save norcross/3563029 to your computer and use it in GitHub Desktop.
modifed core and new filter for non-class related body elements
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
// filter inside theme or plugin | |
function schema_bodyitems($item) { | |
$item[] = 'itemtype="http://schema.org/Blog"'; | |
$item[] = 'itemscope=""'; | |
return $item; | |
} | |
add_filter('body_items','schema_bodyitems'); | |
// core function addition to get said items | |
function get_body_items($item_array = '') { | |
$item = array(); | |
$item_array = apply_filters( 'body_items', $item); | |
if(empty($item_array)) | |
return $items; | |
$items = ' '.join( ' ', $item_array ); | |
return $items; | |
} | |
// modified core function | |
function body_class( $class = '' ) { | |
$items = get_body_items(); | |
// Separates classes with a single space, collates classes for body element | |
echo 'class="' . join( ' ', get_body_class( $class ) ) . '"'. $items; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment