Skip to content

Commit 746ee1e

Browse files
committed
[OpeningHours] Logo for local businesses for schema
1 parent b1390f8 commit 746ee1e

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

widgets/opening-hours.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ protected function _register_controls() {
385385
],
386386
'default' => 'LocalBusiness',
387387
'description' => '<b>CivicStructure</b>: A public structure, such as a town hall or concert hall.<br>
388-
<b>LocalBusiness</b>:A particular physical business or branch of an organization.',
388+
<b>LocalBusiness</b>:A particular physical business or branch of an organization. Site logo is required to be enabled',
389389
'condition' => [
390390
'enable_schema' => 'yes'
391391
]
@@ -828,11 +828,15 @@ protected function render() {
828828
?>
829829

830830
<div class="ma-openinghours-wrapper" <?php echo $enableSchema ? ' itemprop="openingHoursSpecification" itemscope itemtype="http://schema.org/' . $schemaType . '"' : ''; ?>>
831-
832-
<?php if ( $enableSchema && $settings['schema_type'] == "LocalBusiness" ) : ?>
833-
<img style="display:none;" itemprop="image" src="http://via.placeholder.com/350x150" alt="test logo" />
834-
<?php endif; ?>
835-
831+
<?php
832+
// Logo for LocalBusiness Schema
833+
if ( $enableSchema && $settings['schema_type'] == "LocalBusiness" ) :
834+
$logo = wp_get_attachment_image_src( get_theme_mod( 'custom_logo' ) , 'full' );
835+
if ( has_custom_logo() ) {
836+
echo '<img style="display:none;" itemprop="image" src="' . esc_url( $logo[0] ) . '" alt="' . get_bloginfo( 'name' ) . '">';
837+
}
838+
endif;
839+
?>
836840
<div <?php echo $enableSchema ? 'itemprop="name"' : ''; ?> class="ma-oh-header"><?php echo $settings['header_text']; ?></div>
837841

838842
<div class="ma-oh-rows">

0 commit comments

Comments
 (0)