Forked from joshuacharleslake/json-ld-wordpress-custom-fields.json
Created
September 29, 2015 09:05
-
-
Save resonancedesigns/066b440314e1b993dd4b to your computer and use it in GitHub Desktop.
JSON LD using custom fields from wordpress.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="application/ld+json"> | |
{ | |
"@context": "http://schema.org", | |
"@type": "SelfStorage", | |
"address": { | |
"@type": "PostalAddress", | |
"addressLocality": "<?php echo($location_town) ?>", | |
"addressRegion": "<?php echo($location_county) ?>", | |
"postalCode":"<?php echo($location_postcode) ?>", | |
"streetAddress": "<?php echo($location_address_line_1) ?>, | |
<?php | |
if (!empty($location_address_line_2)) { | |
echo''. $location_address_line_2 .', '; | |
} | |
if (!empty($location_address_line_3)) { | |
echo''. $location_address_line_3 .''; | |
} | |
?>" | |
}, | |
"name": "<?php bloginfo('name'); ?>", | |
"telephone": "<?php echo main_branch('tel'); ?>", | |
<?php | |
if ($location_24h == true) { | |
echo ' | |
"openingHours": [ | |
"Mo 00:00-00:00", | |
"Tu 00:00-00:00", | |
"We 00:00-00:00", | |
"Th 00:00-00:00", | |
"Fr 00:00-00:00", | |
"Sa 00:00-00:00", | |
"Su 00:00-00:00" | |
] | |
'; | |
} else { | |
if (!empty($location_openinh_hours)) { | |
echo' | |
"openingHours": [ | |
"Mo '.$location_openinh_hours.'", | |
"Tu '.$location_openinh_hours.'", | |
"We '.$location_openinh_hours.'", | |
"Th '.$location_openinh_hours.'", | |
"Fr '.$location_openinh_hours.'", | |
"Sa '.$location_openinh_hours.'", | |
"Su '.$location_openinh_hours.'" | |
] | |
'; | |
} | |
} | |
?> | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment