Local Business Schema Markup 2020

Local Business Schema Markup 2020

What is Schema?

Schema.org (often called Schema) is a semantic vocabulary of tags (or microdata) that you can add to your HTML to improve the way search engines read and represent your page in SERPs.

MOZ
Schema Markup

🚀 Boost Your SEO Rankings With This Simple Schema Markup Snippet!

This is a quick snippet that contains all the Local Business Schema information that you will need, including:

  • Name
  • Address
  • Reviews
  • Contact Info
  • MapLinks
  • Price
  • Opening Times
  • Social Links

Simply add the following snippet to your header.php / or wherever your <head></head> tags are and please replace the below-filled information (mywebsiteurl, mywebsite etc) with your own!

<!-- LOCAL BUSINESS SCHEMA /-->
<script type="application/ld+json">
{
	"@context": "http://schema.org",
	"@type": "LocalBusiness",
	"name": "My Business Name",
	"aggregateRating": {
		"@type": "AggregateRating",
		"ratingValue": "5",
		"reviewCount": "1"
	},
	"review": [
	{
      "@type": "Review",
      "author": "REVIEW AUTHOR",
      "datePublished": "01-01-2020",
      "description": "The review contents",
      "reviewRating": {
        "@type": "Rating",
        "bestRating": "5",
        "ratingValue": "5",
        "worstRating": "0"
      	}
    }],
	"url": "http://mywebsiteurl.com/",
	"description": "My Website description",
	"telephone": "01302 000000",
	"email": "info@mywebsite.com",
	"image": "https://mywebsiteurl.co.uk/logo.png",
	"contactPoint" : {
	    "@type" : "ContactPoint",
	    "telephone" : "+441302000000",
	    "contactType" : "customer service"
	},
	"address": {
		"@type": "PostalAddress",
		"addressLocality": "Doncaster",
		"addressRegion": "South Yorkshire",
		"postalCode":"DN5...",
		"streetAddress": "Queens Court, Bentley"
	},
	"priceRange": "££",
	"openingHours": "Mo,Tu,We,Th,Fr 09:00-17:00",
	"geo": {
	"@type": "GeoCoordinates",
		"latitude": "53.5373874",
		"longitude": "-1.158099"
	}, 
	"hasMap": "https://www.google.com/maps/place/...",			
	"sameAs" : [ 
		"https://www.facebook.com/",
		"https://twitter.com/"]
	},
}
</script>

Below is an adaptation of the above, a mjority of the fields are pre filled with WordPress infomation such as the title, description, etc and if you have a testimonial post type or similar then you will can update line #15, to reflect your post type, and it will start pulling in the posts and using them as reviews.

Its only a simple adaptation it can go further if you have the knowledge.

<!-- LOCAL BUSINESS SCHEMA /-->
<script type="application/ld+json">
{
	"@context": "http://schema.org",
	"@type": "LocalBusiness",
	"name": "<?php echo get_bloginfo( 'name' ); ?>",
	"aggregateRating": {
		"@type": "AggregateRating",
		"ratingValue": "5",
		"reviewCount": "<?php echo $count_posts = wp_count_posts( 'testimonials' )->publish; ?>"
	},
	"review": [
<?php 				
	$args = array(
		'post_type' => 'testimonials',
		'posts_per_page'	=> -1,
		'order' => 'DESC',
		'orederby' => 'date',
	);
	
	$query = new WP_Query($args);
	if ( $query->have_posts() ) :
	while ( $query->have_posts() ) : $query->the_post();
		echo ' {
	      "@type": "Review",
	      "author": "'.get_the_title().'",
	      "datePublished": "'.get_the_date('d-m-Y', '','', FALSE).'",
	      "description": "'.get_the_content().'",
	      "reviewRating": {
	        "@type": "Rating",
	        "bestRating": "5",
	        "ratingValue": "5",
	        "worstRating": "0"
	      	}
	    }';
	    
	    if (($query->current_post +1) == ($query->post_count)) {
		  echo ' ';
		} else {
			echo ',';
		}
	endwhile;
	wp_reset_postdata();
	endif;
?>
	],
	"url": "<?php echo get_bloginfo( 'url' ); ?>",
	"description": "<?php echo get_bloginfo( 'description' ); ?>",
	"telephone": "01302 000000",
	"email": "info@mywebsite.com",
	"image": "https://mywebsiteurl.co.uk/logo.png",
	"contactPoint" : {
	    "@type" : "ContactPoint",
	    "telephone" : "+441302000000",
	    "contactType" : "customer service"
	},
	"address": {
		"@type": "PostalAddress",
		"addressLocality": "Doncaster",
		"addressRegion": "South Yorkshire",
		"postalCode":"DN5...",
		"streetAddress": "Queens Court, Bentley"
	},
	"priceRange": "££",
	"openingHours": "Mo,Tu,We,Th,Fr 09:00-17:00",
	"geo": {
	"@type": "GeoCoordinates",
		"latitude": "53.5373874",
		"longitude": "-1.158099"
	}, 
	"hasMap": "https://www.google.com/maps/place/...",			
	"sameAs" : [ 
		"https://www.facebook.com/",
		"https://twitter.com/"]
	},
}
</script>

As an added bonus!

See below snippet for adding Search action to your website, add it to the same places as the above between your <head></head> tags.

<!-- LOCAL BUSINESS SCHEMA /-->
<script type="application/ld+json">
{
  "@context" : "http://schema.org",
  "@type" : "WebSite", 
  
  "name" : "&lt?php echo get_bloginfo( 'name' ); ?>",
  "url" : "&lt?php echo get_bloginfo( 'url' ); ?>",
  "potentialAction" : {
    "@type" : "SearchAction",
    "target" : "&lt?php echo get_bloginfo( 'url' ); ?&gt?s={search_term}",
    "query-input" : "required name=search_term"
  }                     
}
</script>

If you require any help in implement this then please contact us or call 01302 568020

This is also offered in our WordPress Support Package