Skip to content

Instantly share code, notes, and snippets.

@jamalrahmat
Last active February 26, 2019 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jamalrahmat/4c4a1e355eb9a9863d97 to your computer and use it in GitHub Desktop.
Save jamalrahmat/4c4a1e355eb9a9863d97 to your computer and use it in GitHub Desktop.
<?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