Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save danielpowney/0d8a7c665e60c5771ea944274cd2cd53 to your computer and use it in GitHub Desktop.
Save danielpowney/0d8a7c665e60c5771ea944274cd2cd53 to your computer and use it in GitHub Desktop.
<?php
/**
* Adds example address, priceRange and telephone data to the LocalBusiness type
*/
function mrp_structured_data_type_localbusiness_example( $schema, $post_id ) {
$structured_data_type = get_post_meta( $post_id, MRP_Multi_Rating::STRUCTURED_DATA_TYPE_POST_META, true );
if ( $structured_data_type === 'LocalBusiness' ) {
return '
"address": {
"@type": "PostalAddress",
"addressLocality": "Seattle",
"addressRegion": "WA",
"postalCode": "98052",
"streetAddress": "20341 Whitworth Institute 405 N. Whitworth"
},
"priceRange": "$$$",
"telephone": "+18005551234",';
}
return '';
}
add_filter( 'mrp_structured_data_type' , 'mrp_structured_data_type_localbusiness_example', 10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment