Hi Tony,
I’ve taken that class approach and extended it a little into a shortcode.
You can see a working demo here:
https://banner-demo.agegate.io/
Clicking yes you should see a grey and a blue banner appear, clicking no they won’t.
Here’s what you need to do to get it working.
Age Gate Settings
As I said before, there’s some specific settings you’ll need to use:
Restriction tab:
- Restrict: All content
- Rechallenge: Unchecked
- Validate using: Unchecked
- Remember: Unchecked (more for the CSS I’ve done!)
Messaging tab:
- Under age validation message set to blank
Appearance:
- Use plugin style on the front end: uncheck
Also worth leaving everything there blank.
Finally Advanced:
- Use JavaScript Age Gate Tick this one
Ok, that’s the settings bit out the way.
Next up, I’ve made a tiny extra plugin which you can download here from dropbox. Just install and activate and it’ll add a short code that you can use wherever you need a banner.
it takes the following parameters:
url: The destination, if required
banner: The image. Can be an ID or a full URL to an image
target: default is _blank
, pass anything else to open in the same window
alt: Alternative text for the image
class: CSS class for the div it creates (default is agb)
e.g
[ag-banner-ad url="https://bbc.co.uk" banner="https://placehold.it/728x90" alt="Text"]
or to use an ID
[ag-banner-ad url="https://bbc.co.uk" banner="4" alt="Text"]
This extra plugin adds a bit of javascript to the page, if a user clicks yes, or already has, it’ll look for any of these banner divs
and add the image inside. If they click no, or haven’t clicked anything, it’ll just do nothing.
The CSS and JS, feel free to change as you need to.
Hope all that makes sense and works for you, let me know if not or if you have any issues.
Cheers
Phil
-
This reply was modified 5 years, 5 months ago by
Phil.