• Resolved qwik3r

    (@qwik3r)


    I’d like to create a recurring pop up of sorts that pulls in dynamic information from a post that gets added to the site each month. I’m trying to limit my interaction with the settings so that I could just set it and forget it. With that being said, I was wondering if it’s possible to set an expiration date for a cookie that hides the pop up to expire on the 1st of each month. I know thee is a “monthly” option but that doesn’t help because someone can click it at any time to close the pop up. Ideally it would expire on the 1st, then show to everyone again after that.

    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Maria T

    (@mariatogonon)

    Hello @qwik3r – thanks for writing in to us!

    As of the moment, our Popup Maker plugin does not support this feature. However, I can forward this to our lead developer as a feature request/improvement for our plugin.

    But, you can easily schedule your popup to display on a specific date & time using the Popups Scheduling Extension plugin. See this link for more details: https://wppopupmaker.com/extensions/scheduling/ This will provide further insights.

    If you have questions or concerns about anything, just please don’t hesitate to reach us back.

    Thread Starter qwik3r

    (@qwik3r)

    Thanks. I’m more or less looking for an easy way to just recur the same pop up without any intervention and have it show up again to anyone that closed it and set a cookie. The scheduling addon might help but doesn’t solve the issue I think of if someone closes the pop up. I ideally want to clear the cookies for that pop up all at the same time. Think of it like a recurring billboard with important info for that person.

    Is there a way to do this? Or a workaround?

    Maria T

    (@mariatogonon)

    Hi @qwik3r – I will need to escalate this to our developers if we can provide a workaround solution.

    We will reply to this thread with an update.

    Your patience is highly appreciated. Thank you.

    Plugin Support mark l chaves

    (@mlchaves)

    Hi @qwik3r,

    Just to confirm: You’d like to make sure that popup is seen at least once on the first of every month to all of your visitors?

    But, you still want to provide a cookie for that popup so your visitors don’t repeatedly see it after they hit the close button?

    If that’s right, you can write custom code to:

    1) Check the date.

    2) If the date matches the first of the month (date = 1), then clear the cookies for that popup.

    3) If a visitor comes on the first of the month, sees the popup, and clicks the close button, respect the cookie that’s set until the first of the next month.

    Here’s an example. Note that the date is set to today (11th) for testing purposes.

    
    /**
     *  Add custom JavaScript scripts to the footer of your site theme.
     *
     * @since 1.0.0
     *
     * @return void
     */
    function monthly_popup_cookie_purge() { ?>
    	<script type="text/javascript">
    		jQuery( document ).ready( function ($) {
    			const date = new Date();
    			// Clear cookies only on a specific date (day of the moth).
    			if ( date.getDate() === 11 ) { // Change this to the date you want.
    				// Don't clear cookies if you've already cleared them today.
    				if ( PUM.getCookie('pum-purged') ) return;
    				// Clear the cookies.
    				PUM.clearCookies( 673 ); // Change the popup ID to yours.
    				// Remember that you've cleared them today.
    				PUM.setCookie( 673, { name: "pum-purged", expires: "+1 day", path: "/" } ); // Change the popup ID to yours.
    			}
    		} ); // jQuery
     	</script>
    <?php }
    add_action( 'wp_footer', 'monthly_popup_cookie_purge', 500 );
    
    /** 
     * Add to your child theme's functions.php file or use a code snippets plugin. 
     */
    

    Feel free to use and tweak it to your needs.

    We hope that helps.

    Let us know if we missed something or if you need anything else.

    Have a great day 🙂

    Mark

    Thread Starter qwik3r

    (@qwik3r)

    So it doesn’t have to only show on the 1st, that is just when the new info will show up. Someone can view it at any time throughout the month, then click to exit out so they don’t see the reminder again. Then when the 1st of the month rolls around again, the cookie for that pop up should be cleared so it shows again to the person. THis time it will have new info in it because it’s dynamically pulling in a blog post.

    So is what you posted in the previous post able to handle that?

    Plugin Support mark l chaves

    (@mlchaves)

    Hey @qwik3r,

    Yes. Correct. Our #3 above should read:

    3) If a visitor comes on the first of the month and onwards, sees the popup, and clicks the close button, then respect the cookie that’s set until the first of the next month.

    Added: “and onwards”. Sorry for the confusion.

    As always test the code to confirm it works for you. Since this is custom code, you’ll be responsible for testing and maintaining it.

    But, we’re happy to answer questions and give guidance any time 🙂

    Cheers!

    • This reply was modified 2 years, 6 months ago by mark l chaves. Reason: Clarification
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Set expiration to first of the month’ is closed to new replies.