Skip to content

Instantly share code, notes, and snippets.

@mafsdisseny
Forked from neilgee/microdata-cpt.php
Last active August 29, 2015 14:18
Show Gist options
  • Save mafsdisseny/57d836c745f9871e6206 to your computer and use it in GitHub Desktop.
Save mafsdisseny/57d836c745f9871e6206 to your computer and use it in GitHub Desktop.
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;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment