Last active
January 19, 2016 16:03
-
-
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
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
<?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