neilgee
2/4/2015 - 7:35 AM

Genesis Microdata Example - Changing a CPT SChema

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;
		}

	}
}