Shoora
2/26/2019 - 2:25 PM

simple-schema-markup

This is a simple schema markup used for WordPress theme. * You can control with WordPress conditional tags

<?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"';	
}