Skip to content

Instantly share code, notes, and snippets.

@neilgee
Created February 4, 2015 07:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save neilgee/3bd2c5dd0bc99a284529 to your computer and use it in GitHub Desktop.
Save neilgee/3bd2c5dd0bc99a284529 to your computer and use it in GitHub Desktop.
Genesis Microdata Example - Changing a CPT SChema
add_action( 'get_header', 'themeprefix_cpt_microdata' );
//Change microdata for events custom post type
function themeprefix_cpt_microdata() {
if ('event' == get_post_type()) {//change to your cpt
//add in the microdata changes
add_filter( 'genesis_attr_entry', 'themeprefix_genesis_attributes_entry', 20 );
function themeprefix_genesis_attributes_entry( $attributes ) {
$attributes['itemtype'] = 'http://schema.org/Event';
return $attributes;
}
add_filter( 'genesis_attr_entry-title', 'themeprefix_genesis_attr_entry_title', 20 );
function themeprefix_genesis_attr_entry_title( $attributes ) {
$attributes['itemprop'] = 'event';
return $attributes;
}
add_filter( 'genesis_attr_entry-content', 'themeprefix_genesis_attributes_entry_content' , 20 );
function themeprefix_genesis_attributes_entry_content( $attributes ) {
$attributes['itemprop'] = 'description';
return $attributes;
}
}
}
@swinggraphics
Copy link

Super useful, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment