• Resolved carmenhobbs

    (@carmenhobbs)


    Hello,

    I would like to add a name field to the Mailchimp Top Bar information and I saw the code snippet posted on your FAQ page, but I’m not quite sure where to add the code. Could someone please clarify where the code snippet should be added in order to have a name field appear on the Mailchimp Top Bar.

    Thank you so much!

    chobbs

    https://www.ads-software.com/plugins/mailchimp-top-bar/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Harish Chouhan

    (@hchouhan)

    Hey Chobbs,

    The code needs to be added to a file named “functions.php” inside your active theme.

    I’ve just done this, works great!

    But it’d be nice to be able to have the name field display before/ to the left of the email field.

    Is that possible?

    Thanks,

    Josef.

    Plugin Author Danny van Kooten

    (@dvankooten)

    Hi Josef,

    If you want to show your additional field just before the email field, please use the following code for that. The only thing that has changed is the “name” of the hook that we use.

    add_action( 'mctb_before_email_field', function() {
        echo '<input type="text" name="NAME" placeholder="Your name" />';
    });
    
    add_filter( 'mctb_merge_vars', function( $vars ) {
        $vars['NAME'] = ( isset( $_POST['NAME'] ) ) ? sanitize_text_field( $_POST['NAME'] ) : '';
        return $vars;
    });

    Ref: Add name field to MailChimp Top Bar

    Hope that helps. If not, let me know!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Adding Name Field to Top Bar’ is closed to new replies.