Skip to content

Instantly share code, notes, and snippets.

@rfmeier
Last active January 19, 2016 16:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rfmeier/5819442 to your computer and use it in GitHub Desktop.
Save rfmeier/5819442 to your computer and use it in GitHub Desktop.
Use the AboutPage microdata schema for your About page with Genesis 2.0
<?php
//* do not include php tag
add_filter( 'genesis_attr_body', 'about_page_body_schema' );
/**
* Callback for Genesis 'genesis_attr_body' filter.
*
* Use the AboutPage microdata schema for the About page.
*
* @package Genesis
* @category Attributes
* @author Ryan Meier http://www.rfmeier.net/
*
* @param array $attributes The array of attributes
* @return array $attributes The array of attributes
*/
function about_page_body_schema( $attributes ) {
// if About page, use the AboutPage schema
if ( is_page( 'about' ) ) {
$attributes['itemtype'] = 'http://schema.org/AboutPage';
}
// if Services page, use the ContactPage schema
if ( is_page( 'services' ) ) {
$attributes['itemtype'] = 'http://schema.org/ContactPage';
}
return $attributes;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment