Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #771950

    I’m trying to link MailChimp to a signup form on my site using hidden merge fields and I want to grab the current page title.

    How can I achieve this? I’m using this code: <input type=”hidden” value=”<?php the_title(); ?>” name=”Location” id=”mce-LOCATION”>

    Is that correct? <php the_title(); ?> Or is there a different code I can try to capture the current page title?

    Sorry if this doesn’t fall within the parameters of support.

    Thank you!

    #771962

    Hey finblue!

    Can you try change to as that can also work outside of loop but get the page title.

    Cheers!
    Basilis

    #772002

    Hmm. It’s still not working, but perhaps the issue is elsewhere. Thank you for your help!!

    #772014

    Hey!

    Basicly, we forgot to use echo, for the results.
    Also, you can try pass the page ID also

    global $post
    echo get_the_title($post->ID);

    :Let me know if that works out better

    Regards,
    Basilis

    #772096

    Thanks! Do I try each line individually? Like this:

    Option 1: <input type=”hidden” value=”<?php global $post; ?>” name=”Location” id=”mce-LOCATION”>

    Option 2: <input type=”hidden” value=”<?php echo get_the_title($post->ID); ?>” name=”Location” id=”mce-LOCATION”>

    I don’t know anything about PHP I’m afraid.

    #772484

    Hi,

    Can you post a screenshot of the form you have mentioned?

    Best regards,
    Nikko

    #772587

    Sure. I’m attaching the code below in private because I’m not sure if it contains sensitive data. The field I need to figure out is the value, here:

    <div class=”mc-field-group”>
    <label for=”mce-LOCATION”>Signup Page </label>
    <input type=”text” value=”” name=”LOCATION” id=”mce-LOCATION”>
    </div>

    • This reply was modified 7 years, 7 months ago by finblue.
    #772591

    I’d like the value to automatically generate whatever the page title is that the sign-up form is on. I’m using MailChimp.

    #774071

    Any updates with this?

    Thank you!

    #775235

    Hi,

    Sorry for the late response, try to do the following steps:

    1. Install https://wordpress.org/plugins/php-code-widget/
    2. Go to Appearance > Widgets, create a new Widget Area, call it Mailchimp Form
    3. Use PHP Code Widget and place it under Mailchimp form and insert this code: https://pastebin.com/0jxTVHg4
    4. Edit the page you want the form to appear and use a Widget Area and choose Mailchimp Form

    The change made to the code you gave is:

    <input type="hidden" value="<?php the_title(); ?>" name="LOCATION" id="mce-LOCATION">

    I apologize again and thank you for your patience :)

    Best regards,
    Nikko

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.