Hello,
Thank you for contacting Rank Math today.
This should be possible via Rank Math > Titles & Meta > Local SEO as shown below:
Looking forward to helping you. Thank you.
Hi Michael, thanks for your reply.
I’m referring to the structured data that you set up for an individual page through “Rank Math SEO” -> “Rich Snippet”:
https://drive.google.com/drive/folders/1hY1oWKpftp1FhyQgGTbTRbCia8odXncE?usp=sharing
This is what the code looks like:
"openingHoursSpecification":{"@type":"OpeningHoursSpecification","dayOfWeek":["monday","tuesday","wednesday","thursday","friday","saturday"],"opens":"10:00 AM","closes":"09:00 PM"}
Hello,
Thank you for contacting Rank Math today.
Here is some example code that you can use on your theme’s functions.php file to add some custom time for your restaurant:
/**
* Filter to modify restaurant schema
*
* @param array $entity Snippet Data
* @return array
*/
add_filter( 'rank_math/snippet/rich_snippet_restaurant_entity', function( $entity ) {
unset($entity['openingHoursSpecification']);
$entity['openingHours'] = [
"Mo-We 11:00-14:30",
"We-Th 17:00-21:30",
"Fr-Sa 17:00-22:00"
];
return $entity;
});
Looking forward to helping you. Thank you.
Hi Michael,
I’m not sure I understand, is this supposed to be set at a site or organization level?
I have set up a post type (“restaurants”) which contains several posts (different restaurants). Each restaurant has it’s own opening hours, which varies depending on the day of the week.
Editing the rich snippet section for each restaurant, only gives me the option of selecting one range of opening hours for all weekdays. That is, I’m not able to specify a unique range of opening hours for each day.
This is possible according to the Schema, where multiple opening hours for different days can be separated by comma, but Rank Math does not seem to allow this.
If this is not currently possible, I would strongly recommend adding the functionality to have different opening hours for different days in a future update, as it is quite common for a restaurant’s opening hours to vary depending on the day of the week.
Hi there,
Thanks for the follow up.
In this type of a use case, you can use custom fields to save the unique opening hours for each of the posts and then modify the snippet to load the values dynamically to Rank Math.
I would be happy to pass this on as a feature request as you suggested so that this option can be available in the plugin.
Thank you.
Hi Markant,
I wanted to chime in and mentioned that we have marked this as a feature request already. We will be adding this to the plugin very soon.
We would really appreciate your patience in this matter.
Awesome, looking forward to it. Thanks!
Hi there,
I am glad that this information proved useful 🙂
Feel free to contact us should any other issues come up. Thank you.