Created
February 10, 2017 15:26
-
-
Save alexstandiford/e678be1d328f51205fc6e9d00f6d5348 to your computer and use it in GitHub Desktop.
Age Verifier Template Override
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php //do not include this line when you copy/paste | |
function eav_override_template(){ | |
$result = ''; | |
//Starts the form | |
$result = "<div id='taseav-age-verify' class='taseav-age-verify'>"; | |
$result .= "<form class='taseav-verify-form'>"; | |
$result .= "<h2>" . get_option('eav_form_title') . "</h2>"; | |
//If the settings call to enter the age, do this | |
if(get_option('eav_form_type') == 'eav_enter_age'){ | |
$result .= "<div class='taseav-month'>"; | |
$result .= "<label>Month</label>"; | |
$result .= "<input name='month' type='number' min='1' max='12' required>"; | |
$result .= "</div>"; | |
$result .= "<div class='taseav-day'>"; | |
$result .= "<label>Day</label>"; | |
$result .= "<input name='day' type='number' min='1' max='31' required>"; | |
$result .= "</div>"; | |
$result .= "<div class='taseav-year'>"; | |
$result .= "<label>Year</label>"; | |
$result .= "<input name='year' type='number' min='1900' max='" . date("Y") . "' required>"; | |
$result .= "</div>"; | |
$result .= "<input type='submit' value='" .get_option('eav_button_value'). "'>"; | |
} | |
//If the settings call to simply verify the age, do this. | |
if(get_option('eav_form_type') == 'eav_confirm_age'){ | |
$result .= "<input name='overAge' type='submit' value='" . get_option('eav_over_age_value') . "'>"; | |
$result .= "<input name='underAge' type='submit' value='" . get_option('eav_under_age_value') . "'>"; | |
} | |
//Closes out the form | |
$result .= "</form>"; | |
$result .= "</div>"; | |
return $result; | |
} | |
add_filter('eav_modal_template','eav_override_template'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment