Skip to content

Instantly share code, notes, and snippets.

@janizde
Last active March 28, 2020 12:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save janizde/88eaad44471171e093f6e937c8e9be61 to your computer and use it in GitHub Desktop.
Save janizde/88eaad44471171e093f6e937c8e9be61 to your computer and use it in GitHub Desktop.
Opening Hours extension showing a custom message on mondays
<?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