Created
September 4, 2019 09:06
-
-
Save anubhavbhatt/c37ce99ff3efc549f23d55e281e502b1 to your computer and use it in GitHub Desktop.
Notification Scroll Bar Wordpress with Cookie
This file contains 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
/** After the functions.php code here **/ | |
/** | |
* Sets a cookie for popup shown once in a day. | |
*/ | |
function set_cookie() { | |
$cookie_value = date('F j, Y g:i a'); | |
if ( !isset($_COOKIE['floating_notification_bar']) ) { | |
setcookie('floating_notification_bar', $cookie_value, time()+86400, '/'); | |
} | |
} | |
add_action( 'init', 'set_cookie' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Added Notification Scroll Bar WordPress with Cookie