@@ -793,24 +793,51 @@ protected function render() {
793793 return ;
794794 }
795795 ?>
796- <div class="ma-openinghours-wrapper">
796+ <div itemprop="openingHoursSpecification" itemscope itemtype="http://schema.org/CivicStructure" class="ma-openinghours-wrapper">
797+
798+ <img style="display:none;" itemprop="image" src="http://via.placeholder.com/350x150" alt="test logo" />
797799
798- <div class="ma-oh-header"><?php echo $ settings ['header_text ' ]; ?> </div>
800+ <div itemprop="name" class="ma-oh-header"><?php echo $ settings ['header_text ' ]; ?> </div>
799801
800802 <div class="ma-oh-rows">
801803 <?php foreach ( $ settings ['mt_openinghours_data ' ] as $ item ) :
802804 $ closingTime = $ item ['opening_business_time ' ] === "Closed " || $ item ['opening_business_time ' ] === "24 hours " ? false : true ;
805+ $ schemaDay = "" ;
806+ switch ( $ item ['business_day ' ] ) {
807+ case 'All Days ' : $ schemaDay = "Mo-Su " ;
808+ break ;
809+ case 'Monday - Friday ' : $ schemaDay = "Mo-Fr " ;
810+ break ;
811+ case 'Saturday - Sunday ' : $ schemaDay = "Sa-Su " ;
812+ break ;
813+ default : $ schemaDay = substr ($ item ['business_day ' ], 0 , 2 );
814+ }
803815 ?>
804816 <div class="ma-oh-row <?php echo ($ settings ['striped_effect ' ] == true ) ? 'mt-striped ' : '' ; ?> elementor-repeater-item-<?php echo $ item ['_id ' ]; ?> ">
805- <div class="ma-oh-day"><?php echo $ item ['business_day ' ]; ?> </div>
806- <div class="ma-oh-time">
807- <?php echo $ item ['opening_business_time ' ]; echo $ closingTime ? " - " .$ item ['closing_business_time ' ] : '' ; ?>
817+ <div class="ma-oh-day">
818+ <time itemprop="openingHours" datetime="<?php echo $ schemaDay ; ?> "><?php echo $ item ['business_day ' ]; ?> </time>.
808819 </div>
820+
821+ <div class="ma-oh-time" itemprop="openingHoursSpecification" itemscope itemtype="http://schema.org/OpeningHoursSpecification">
822+ <?php if ( $ item ['opening_business_time ' ] === "24 hours " ) { ?>
823+
824+ <time itemprop="opens" content="<?php echo date ("H:i " , strtotime ("12:00 AM " )); ?> "><?php echo $ item ['opening_business_time ' ]; ?> </time>
825+
826+ <time itemprop='closes' content='<?php echo date ("H:i " , strtotime ("12:00 PM " )); ?> '></time>
827+
828+ <?php } else { ?>
829+ <time itemprop="opens" content="<?php echo date ("H:i " , strtotime ($ item ['opening_business_time ' ])); ?> "><?php echo $ item ['opening_business_time ' ]; ?> </time>
830+
831+ <?php echo $ closingTime ? " - <time itemprop='closes' content=' " . date ("H:i " , strtotime ($ item ['closing_business_time ' ])) ."'> " . $ item ['closing_business_time ' ] ."</time> " : '' ;
832+ } ?>
833+
834+ </div>
835+
809836 </div>
810837 <?php endforeach ; ?>
811838 </div>
812839
813- <div class="ma-oh-footer"><?php echo $ settings ['footer_text ' ]; ?> </div>
840+ <div itemprop="description" class="ma-oh-footer"><?php echo $ settings ['footer_text ' ]; ?> </div>
814841
815842 </div>
816843 <?php
0 commit comments