Plugin Author
Phil
(@philsbury)
Hi @thatgerhard,
You should be able to do that with the age_gate_before hook. Here’s and example: https://agegate.io/docs/styling/adding-custom-markup
Thanks
Phil
Hi @philsbury
The age_gate_before fires after the site’s header include. I need to add something in the <head></head> tags. 🙂
G
Plugin Author
Phil
(@philsbury)
Ah I see. If you are using the “Standard/PHP” version it’s not currently possible (though pretty easy for me to add if need be). Although the standard wp_head() is still called.
If you’re using the JS version, there’s a couple of events that fire that could be useful, agegateshsown and agegatepassed. You could do something like this:
(function($){
var link = document.createElement('link');
link.setAttribute('rel', 'stylesheet');
link.setAttribute('href', '//stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css');
$(document).on('agegateshown', function () {
document.getElementsByTagName('head')[0].appendChild(link);
console.log(link.parentNode);
});
$(document).on('agegatepassed', function () {
link.parentNode.removeChild(link);
});
})(jQuery);
Let me know if that helps. Happy to add a couple of hooks in though for the php version 🙂
Thanks
Phil
I’m not sure tracking will respond correctly in that on event.. That event probably only fires after the page content has loaded?
Plugin Author
Phil
(@philsbury)
If would fire then, yes. What are you trying to track? You should still be able to push tracking events from that event which would be the only way with the JS version.
Thanks
Phil
I think I’m being dumb, I’m going to use wp_head to include my tracking, so that it comes up in the age gate page too. It’s currently in the header.php
Thank you for you patience 🙂
Plugin Author
Phil
(@philsbury)
Haha no worries! If you add it using ‘wp_head’ then it’ll show up in your header.php and in age gate. Plus if you switched to JS mode at any point it’d still work as that would load the theme header 🙂
Thanks
Phil