Created
June 13, 2018 08:16
-
-
Save DavidPeralvarez/58c384db36d74a57c77a20f39e5e6ecb to your computer and use it in GitHub Desktop.
MemberPerks mp_cf7_custom_shortcode completa
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 | |
// Add custom shortcodes to Contact Form 7 WP plugin | |
add_action( 'wpcf7_init', 'mp_cf7_custom_shortcode' ); | |
function mp_cf7_custom_shortcode(){ | |
wpcf7_add_form_tag( 'show_member_level', 'cf7_get_member_level' ); | |
} | |
function cf7_get_member_level(){ | |
$memberLevel = mp_get_member_level(); | |
if(empty($memberLevel)): | |
$value = 0; | |
else: | |
$value = $memberLevel['member_level']; | |
endif; | |
return '<input type="hidden" name="member-level" value="'. $value .'" />'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Buenas Tardes David, Tengo una duda este codigo que tu generaste se añade en el functions.php de wordpress???
Quedo atento muchas gracias.