Skip to content

Instantly share code, notes, and snippets.

@DavidPeralvarez
Created June 13, 2018 08:16
Show Gist options
  • Save DavidPeralvarez/58c384db36d74a57c77a20f39e5e6ecb to your computer and use it in GitHub Desktop.
Save DavidPeralvarez/58c384db36d74a57c77a20f39e5e6ecb to your computer and use it in GitHub Desktop.
MemberPerks mp_cf7_custom_shortcode completa
<?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 .'" />';
}
@johnedisong
Copy link

Buenas Tardes David, Tengo una duda este codigo que tu generaste se añade en el functions.php de wordpress???

Quedo atento muchas gracias.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment