age_gate_shown not firing? | WordPress.org

Hi Phil —

Using v3 (we just updated), our nav is showing ‘behind’ the age gate. This wasn’t the case with V2. I tried using age_gate_shown, the listener is added (I see mine in dev tools along with yours) but it never fires. Currently code is there to hide the nav and display an alert but nothing happens (the alert is for testing).

This is the function in stockyards.js straight out of your knowledgebase:

window.addEventListener('age_gate_shown', function () {
	alert('working');
	$('#navigation').hide();
});

There might be a better way to accomplish this too, if so I’m all ears —

Thank you! 🙂

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

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Your Advertisement Here