Last active
February 27, 2018 16:41
-
-
Save Archie22is/8348ef1cde5683b0c4d4db13e7b7333f to your computer and use it in GitHub Desktop.
Adding custom tags to WPForms
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
/** | |
* WPForms Custom Smart Tags | |
* The following code will turn {my_smart_tag} into “Testing 1 2 3”. | |
* You can replace the tag name and value with whatever you’d like to use. | |
* | |
* @author Bill Erickson | |
* @see http://www.billerickson.net/code/wpforms-custom-smart-tags | |
*/ | |
function ea_custom_smart_tags( $content, $tag ) { | |
if( 'you_password' == $tag ) { | |
$value = 'Testing 1 2 3'; | |
$content = str_replace( '{' . $tag . '}', $value, $content ); | |
} | |
return $content; | |
} | |
add_filter( 'wpforms_smart_tag_process', 'ea_custom_smart_tags', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment