Last active
June 8, 2022 13:57
-
-
Save kimcoleman/377c7652028cdd1eae2baaaf230d6001 to your computer and use it in GitHub Desktop.
Turn off the WooCommerce Store Notice at a specific date and time.
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 | |
/** | |
* Turn off the WooCommerce Store Notice at a specific date and time. | |
*/ | |
function modify_woocommerce_demo_store_turn_off_date( $notice_html ) { | |
// Set the current date variable. | |
$current_date = date( 'Y-m-d H:i:s', current_time( 'timestamp' ) ); | |
// Change this line to set the store notice end date and time variable. | |
$end_date = '2022-06-08 10:00:00'; | |
// If the current date is before the end date, show banner. | |
if ( $current_date < $end_date ) { | |
return $notice_html; | |
} | |
// Return an empty string if not within the set time. | |
return ''; | |
} | |
add_filter( 'woocommerce_demo_store', 'modify_woocommerce_demo_store_turn_off_date', 11 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment