Created
February 4, 2015 07:35
-
-
Save neilgee/3bd2c5dd0bc99a284529 to your computer and use it in GitHub Desktop.
Genesis Microdata Example - Changing a CPT SChema
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
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
Super useful, thank you!