Skip to content

Instantly share code, notes, and snippets.

@anubhavbhatt
Created September 4, 2019 09:06
Show Gist options
  • Save anubhavbhatt/c37ce99ff3efc549f23d55e281e502b1 to your computer and use it in GitHub Desktop.
Save anubhavbhatt/c37ce99ff3efc549f23d55e281e502b1 to your computer and use it in GitHub Desktop.
Notification Scroll Bar Wordpress with Cookie
/** 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' );
@anubhavbhatt
Copy link
Author

Added Notification Scroll Bar WordPress with Cookie

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment