Last active
March 28, 2020 12:34
-
-
Save janizde/88eaad44471171e093f6e937c8e9be61 to your computer and use it in GitHub Desktop.
Opening Hours extension showing a custom message on mondays
This file contains hidden or 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 | |
use OpeningHours\Module\Shortcode\IsOpen; | |
use OpeningHours\Util\Dates; | |
add_filter('op_shortcode_attributes', function (array $attributes, $shortcode) { | |
if ($shortcode instanceof IsOpen && (int) Dates::getNow()->format('w') === 1) { | |
$attributes['text'] = 'Custom monday message'; | |
$attributes['classes'] = ''; // Remove open / closed styles | |
} | |
return $attributes; | |
}, 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment