Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 210725

first and lastname

$
0
0

Replies: 0

Hi there,
I have 3 fields in my mailchimp signup. I’ve seen the post and support on how to add a name field, but how could I add 2 extra fields – first and last name? There’s certainly plenty of room on the topbar! The mailchimp tags are FNAME and LNAME

I have tried placing this in my functions file (child theme) but it’s only showing surname.
add_action( ‘mctb_before_surname_field’, function() {
echo ‘<input type=”text” name=”FNAME” placeholder=”First name” />’;
});

add_action( ‘mctb_before_email_field’, function() {
echo ‘<input type=”text” name=”LNAME” placeholder=”Surname” />’;
});
add_filter( ‘mctb_merge_vars’, function( $vars ) {
$vars[‘NAME’] = ( isset( $_POST[‘ FNAME’] ) ) ? sanitize_text_field( $_POST[‘FIRST NAME’] ) : ”;
return $vars;
});
add_filter( ‘mctb_merge_vars’, function( $vars ) {
$vars[‘NAME’] = ( isset( $_POST[‘LNAME’] ) ) ? sanitize_text_field( $_POST[‘SURNAME’] ) : ”;
return $vars;
});

Your help would be really appreciated. Thanks in advance.


Viewing all articles
Browse latest Browse all 210725

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>