Created
November 6, 2013 12:24
-
-
Save felixarntz/7335240 to your computer and use it in GitHub Desktop.
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 | |
function yourtheme_html_schema() | |
{ | |
$base = 'http://schema.org/'; | |
if( is_page( 5 /* type in the ID of your contact page here, 5 is an example */ ) ) | |
{ | |
$type = 'ContactPage'; | |
} | |
elseif( is_page( 4 /* type in the ID of your about page here, 5 is an example */ ) ) | |
{ | |
$type = 'AboutPage'; | |
} | |
elseif( is_singular( array( 'book', 'movie' ) /* add custom post types that describe a single item to this array */ ) ) | |
{ | |
$type = 'ItemPage'; | |
} | |
elseif( is_author() ) | |
{ | |
$type = 'ProfilePage'; | |
} | |
elseif( is_search() ) | |
{ | |
$type = 'SearchResultsPage'; | |
} | |
else | |
{ | |
$type = 'WebPage'; | |
} | |
echo 'itemscope="itemscope" itemtype="' . $base . $type . '"'; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment