Hello,
Thank you for contacting Rank Math today.
The local SEO schema is only added on the homepage, contact and about us page.
Please note that the schema data will still be added to the page even without having the shortcode added the page once your select your about us and contact page via Rank Math > Titles & Meta > Local SEO page.
We don’t currently have any options to add extra fields to this schema but you can generate your very own local schema in JSON-LD format and add it to the head section instead of Rank Math’s by using the following filter:
/**
* Collect data to output in JSON-LD.
*
* @param array $unsigned An array of data to output in json-ld.
* @param JsonLD $unsigned JsonLD instance.
*/
add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
return [];
}, 10, 2);
Looking forward to helping you. Thank you.
ββββββ
Hi Michael,
1- the map in
isnβt suitable, how can I :
– change the size of the map
– change the type of the map to have service area instead of physical location
2- to use my own local schema using the previous filter, should I disable the RM local schema or both will be integrated together.
thanks
Hello,
Thank you for contacting Rank Math today.
1). You can use some CSS to change the dimensions of the map using the following class:
.rank-math-contact-map iframe{
width:
height:
}
2). I am afraid that this would require advanced customization which is not covered within the scope our support desk.
3). You should disable the Rank Math local schema if you intend to add custom schema.
Looking forward to helping you. Thank you.
ββββββ
I’ve just noticed issue with the above code, it needs if statement to check that the page doesn’t have local business schema before adding the extra fields to the page! wt is the right if statement condition to use?
thank you
Hi Michael,
forget about the code and my previous reply, I will post it in the right topic π
1- the css for the map iframe doesn’t work?! I tried a lot of css classes and nothing worked.
2- is there a filter to change the src of the iframe so I can replace the map with my own map.
3- can I have separate shortcodes for map, social, address, contact, so I use only wt i need.
thanks for ur help and pro assistance
c.k.
Hi Michael,
1- the css for the map iframe didn’t work?! I tried a lot of css classes and nothing worked.
2- is there a filter to change the src of the iframe so I can replace the map with my own map.
3- I used the filter above to add extra fields to RM local schema, I added “areaServed” field and to ensure it will integrate with the rm local schema I used same @type & @id, I see this worked fine with me and no duplicate local business schema appeared.
can you please confirm if this process is right to integrate & add extra fields to rm schemas ?
I used this code:
add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
$data['LocalBusiness'] = [
'@context' => 'https://schema.org',
'@type' => 'LocalBusiness',
'@id' => 'https://abc.com/#organization',
'areaServed' => 'CA-ON'
];
return $data;
}, 10, 2);
thanks again for ur pro assistance and patience
c.k.
Hi Ce kay,
Apologies for the delay in getting back to you.
I can suggest that you use the following filter to change the iframe src:
add_filter( 'shortcode/contact/map_iframe_src', function($address){
return $address;
}
For more info on this, please take a look at class-shortcodes.php on this path: \wp-content\plugins\seo-by-rank-math\includes\frontend.
Your addition of the local SEO data looks quite neat I don’t think that this should cause any issues if it checks off on the structured data testing tool.
I hope this helps.
Hi Michael,
thanks v much, the filter works fine with me.
feedback: the facebook link at the
open in the same page while it should open in new page.
Hello,
We are so glad to be of help. We are always here if you need us in the future. We will see about improving the shortcode and add an option to open the FB link in a new tab.
Hey, if it isn’t too much to ask for – would you mind leaving us a review here?
https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post
It only takes a couple of minutes but helps us tremendously.
It would mean so much to us.
Thank you.