Last active
June 18, 2020 10:18
-
-
Save danielpowney/0d8a7c665e60c5771ea944274cd2cd53 to your computer and use it in GitHub Desktop.
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
<?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