• Resolved gfal

    (@gfal)


    My client asked for a possibility to set an expiry date to the banner such that the banner automatically does not show up after such date. Would it be possible to code such option?

    Unfortunately I couldn’t find an appropriate filter to change the banner text programmatically, so I created an JS based solution for now. For those who are interested in that solution:
    -) create a custom JS within in the plugin’s settings:
    const expirydate = new Date(”November 23 2021 03:30“);
    -) enquee a custom JS in your child-theme which checks the date an removes the banner:

    const now = new Date();
    window.onload=function() {
    	if (expirydate < now{ 
    		document.getElementById('simple-banner').remove();
    	}
    }

    By the way, thank you very much for this tiny and elegant plugin!

    • This topic was modified 3 years ago by gfal. Reason: spelling

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author rpetersen29

    (@rpetersen29)

    This feature is currently in my backlog. Until it is completed the solution you posted should work. Be sure to also remove any custom CSS you may have added.

    Thread Starter gfal

    (@gfal)

    sounds good, thanks for your quick reply!
    @JS-solution above: in the if-condition a closing ) is missing..

    darrylhadfield

    (@darrylhadfield)

    I believe I”d asked about the expiration date a while back, too – and, @rpetersen29 it would be even better if that were granular to the point of HH:MM:SS as well.

    Your plugin’s a fantastic little tool, the only thing that comes even remotely close to my ideal. I’ll be throwing cash at you for “pro” when that has an expiration date, because that will get it 2/3 of the way to “perfect” for me.

    (and if you care, the final third is… if I could push it to use text – or ideally, a JSON payload in text format – on another website, for the banner text and expiration. I use this as a mechanism to notify clients of pending server updates.)

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Feature Request: Expiry Date’ is closed to new replies.