Last active
February 26, 2019 14:25
-
-
Save jamalrahmat/4c4a1e355eb9a9863d97 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 | |
/** | |
* This is a simple schema markup used for WordPress theme. | |
* You can control with WordPress conditional tags. | |
* | |
* Example: | |
* <body <?php starter_body_markup(); ?>> | |
*/ | |
function starter_head_markup() { | |
echo 'itemscope itemtype="http://schema.org/WebSite"'; | |
} | |
function starter_body_markup() { | |
$schema = 'http://schema.org/'; | |
if ( is_search() ) { | |
$type = 'SearchResultsPage'; | |
} else { | |
$type = 'WebPage'; | |
} | |
echo 'itemscope itemtype="' . $schema . $type . '"'; | |
} | |
function starter_site_header_markup() { | |
echo 'itemscope itemtype="http://schema.org/WPHeader"'; | |
} | |
function starter_nav_markup() { | |
echo 'itemscope itemtype="http://schema.org/SiteNavigationElement"'; | |
} | |
function starter_article_markup() { | |
echo 'itemscope itemtype="http://schema.org/BlogPosting"'; | |
} | |
function starter_author_markup() { | |
echo 'itemscope itemtype="http://schema.org/Person"'; | |
} | |
function starter_sidebar_markup() { | |
echo 'itemscope itemtype="http://schema.org/WPSidebar"'; | |
} | |
function starter_site_footer_markup() { | |
echo 'itemscope itemtype="http://schema.org/WPFooter"'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment