Skip to content

Instantly share code, notes, and snippets.

@brycejacobson
Created August 30, 2013 18:38
Show Gist options
  • Save brycejacobson/6392986 to your computer and use it in GitHub Desktop.
Save brycejacobson/6392986 to your computer and use it in GitHub Desktop.
Genesis custom context with filter and callback to append the custom attributes.
<?php
add_filter( 'genesis_attr_movie', 'custom_add_movie_attr' );
/**
* Callback for dynamic Genesis 'genesis_attr_$context' filter.
*
* Add custom attributes for the custom filter.
*
* @param array $attributes The element attributes
* @return array $attributes The element attributes
*/
function custom_add_movie_attr( $attributes ){
// add itemscope
$attributes['itemscope'] = '';
// add the Movie itemtype schema
$attributes['itemtype'] = 'http://schema.org/Movie';
// return the attributes
return $attributes;
}
<?php
genesis_markup( array(
'html5' => '<div %s>',
'xhtml' => '<div>',
'context' => 'movie'
) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment