Tagged: social profiles, structured data
Hi there,
We are using the Enfold template and would like to add structured data so our social profiles will show. The structured data script is a little different that what’s used to generate Sitelinks, which the Yoast plugin already does.
Here is an example of the script that needs to be inserted into the homepage.
<script type=”application/ld+json”>
{ “@context” : “http://schema.org”,
“@type” : “Organization”,
“name” : “Your Organization Name”,
“url” : “http://www.your-site.com”,
“sameAs” : [ “http://www.facebook.com/your-profile”,
“http://www.twitter.com/yourProfile”,
“http://plus.google.com/your_profile”%5D
}
</script>
Where within the WordPress panel do we need to go to insert this after appropriate edits?
The Google link about this form of structured data is here: https://developers.google.com/webmasters/structured-data/customize/social-profiles
Hey Brandon!
You can use a WordPress hook for that, try adding this at the very end of your theme / child theme functions.php file:
function custom_func() {
?>
<script type=”application/ld+json”>
{ “@context” : “http://schema.org”,
“@type” : “Organization”,
“name” : “Your Organization Name”,
“url” : “http://www.your-site.com”,
“sameAs” : [ “http://www.facebook.com/your-profile”,
“http://www.twitter.com/yourProfile”,
“http://plus.google.com/your_profile”]
}
</script>
<?php
}
add_action('wp_footer', 'custom_func');
Cheers!
Josue