How to add custom content to your Age Verification popup

0 minutes, 43 seconds

Our Age Verification plugin is built with you in mind, knowing that at times you’ll want to customize your site in a way that isn’t available via a default option.

That’s where the plugin’s filters come in, because by adding a simple code snippet to your theme functions.php file, you can add new content via one of the included filters.

Below is an example of how the default Age Verification popup looks.

This is the filter we’ll be using to add custom content to our popup:

avwp_after_popup_content

The following code snippet will add a message about accepting your terms, but could easily be changed to display anything you’d like.

<?php
/**
* Add content after the Age Verification pop up content
*
* @author Robert DeVore <deviodigital@gmail.com>
* @link https://www.wordpress.org/plugins/dispensary-age-verification/
* @return string
*/
function acme_after_popup_content( $string ) {
// Change the following to anything you'd like to display.
$string = __( 'By clicking YES you agree to our Terms of Service', 'acme-lang' );
return $string;
}
add_filter( 'avwp_after_popup_content', 'acme_after_popup_content' );

And this displays in your popup like the image below.

View all filters included in the Age Verification for WordPress plugin.

Was this article helpful?