jasonsyourhuckleberry
9/27/2018 - 3:46 PM

JSON-LD WordPress implementation

Stick JSON-LD code in a custom field called 'schema' and use the PHP snippet to insert into relevant page. PHP should go into header.php just before closing tag.

<script type="application/ld+json">
{ "@context" : "http://schema.org",
  "@type" : "Organization",
  "legalName" : "Elite SEM",
  "url" : "http://elitesem.com/",
  "contactPoint" : [{
    "@type" : "ContactPoint",
    "telephone" : "+1-646-350-2789",
    "contactType" : "customer service"
  }]
  "logo" : "http://elitesem.com/wp-content/uploads/2014/03/Elite_SEM_Logo_2014.png",
  "sameAs" : [ "http://www.facebook.com/EliteSEM",
    "http://www.twitter.com/elitesem",
    "http://plus.google.com/+Elitesem",
    "https://www.youtube.com/user/EliteSEMInc",
    "http://www.linkedin.com/company/elite-sem",
    "https://www.wikidata.org/wiki/Q20736641"]
}
</script>
<?php
$schema = get_post_meta(get_the_ID(), 'schema', true);
if(!empty($schema)) {
	echo $schema;
}
?>