-
AuthorPosts
-
April 4, 2017 at 8:38 pm #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!
April 4, 2017 at 8:54 pm #771962Hey finblue!
Can you try change to as that can also work outside of loop but get the page title.
Cheers!
BasilisApril 4, 2017 at 9:29 pm #772002Hmm. It’s still not working, but perhaps the issue is elsewhere. Thank you for your help!!
April 4, 2017 at 9:46 pm #772014Hey!
Basicly, we forgot to use echo, for the results.
Also, you can try pass the page ID alsoglobal $post echo get_the_title($post->ID);
:Let me know if that works out better
Regards,
BasilisApril 5, 2017 at 12:30 am #772096Thanks! 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.
April 5, 2017 at 1:00 pm #772484Hi,
Can you post a screenshot of the form you have mentioned?
Best regards,
NikkoApril 5, 2017 at 2:47 pm #772587Sure. 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.
April 5, 2017 at 2:48 pm #772591I’d like the value to automatically generate whatever the page title is that the sign-up form is on. I’m using MailChimp.
April 7, 2017 at 4:39 pm #774071Any updates with this?
Thank you!
April 10, 2017 at 4:50 am #775235Hi,
Sorry for the late response, try to do the following steps:
- Install https://wordpress.org/plugins/php-code-widget/
- Go to Appearance > Widgets, create a new Widget Area, call it Mailchimp Form
- Use PHP Code Widget and place it under Mailchimp form and insert this code: https://pastebin.com/0jxTVHg4
- 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 -
AuthorPosts
- You must be logged in to reply to this topic.