Skip to content

Instantly share code, notes, and snippets.

@norcross
Created September 1, 2012 02:49
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 norcross/3563029 to your computer and use it in GitHub Desktop.
Save norcross/3563029 to your computer and use it in GitHub Desktop.
modifed core and new filter for non-class related body elements
// 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