Event Title

This topic contains 7 replies, has 2 voices, and was last updated by  Stephen Harris 8 years, 5 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #24304

    Hello, we own the Pro version of Event Organiser and need to make only one Event Title pre-populate into a Ninja Forms field. I’ve tried suggestions from the forum, but the only solution I found was to pull the Page name into the field, which in our instance will not work because we have an “event tag” setup for that page, so it is only pulling the page name “Children’s Registration” instead of the actual event name. Do you have code for this? Thank you.

    The code that was previously used was {Event} in cformsII and then this code is on the Children’s Registration page: <!–cforms name=”standard child registration”–>

    I need new code (shortcode?) to pull the event title into Ninja Forms. Let me know if you need more information.

    Diana Weaver
    #24318

    Hi Diana,

    Just to clarify, you want a particular event title to be pre-filled into one of the (Ninja form) fields when the page initially loads?

    Sorry, but I think this is a question for Ninja Forms – I’m not familiar with their API enough to be able to help here.

    Though, if you want a field just to have a particular default value, I believe Ninja Forms provides a setting for this in their form builder. If you, on the other hand, you don’t want the user to be able to change the value, you could use a hidden field.

    What solution have you found for pulling in the page name? That might be adaptable… pages and events are similar in that they are both ‘post types’ – they live in the same database table.

    Stephen Harris
    #24320

    Yes, you have a shortcode that will bring in the page name, but we need it to bring in the Event Title name.

    Here is the code I’ve found through your forum that brings in the page name, but we need it to bring in the Event Title: [eo_events title=”Event title”]

    Any ideas?

    Diana Weaver
    #24332

    Is their a query string you could give to help bring in the Event Title?

    Diana Weaver
    #24346

    Hi Diana,

    It would be possible to create a shortcode to return the title, but it’s not clear to me how you are determining which event to get the title of?

    You mentioned the page as an ‘event tag’, could you give a bit more detail on how that references that the desired event and where that data is stored (is it a custom field, for instance, storing the event ID?)

    Stephen Harris
    #24356

    Thank you. Here is the source code on the page:

    <div class=”register button”>Register!</div>

    So you click on the register button for an event and it Pops open with the event title already prepopulated.

    So basically URL parameters are being set to pull the event name through a query string. Here is a link I found through Ninja Forms that explains, but I’m unsure how to attach your plugin Event titles into the query: http://www.wpmusketeer.com/pre-populate-ninja-forms-fields-from-url-parameters/

    Thank you again for your help! 🙂

    Diana Weaver
    #24362

    Sorry that source code didn’t come through. Here it is again:

    <div class=”register button”>[Register!][1]</div>

    [1]: http://basehorlibrary.org/register-children/?evnt=LEGO WeDo Robotics October Classes

    • This reply was modified 8 years, 5 months ago by  Diana Weaver.
    Diana Weaver
    #24365

    Ok, so you have a register link for an event, and the user clicks it and is taken a to Ninja Forms form, and you want the event title in the URL so it’s repopulated in the form.

    In what context is the register button, and how does it know which event it should be referencing? For instance, is the register link on the event page itself?

    If so you, you can get the title using the PHP code:

    <?php $title = get_the_title(); ?>
    

    If you need a shortcode, then you can create with one with the following (this will need to go in a custom plug-in, or theme’s functions.php):

     add_shortcode( 'the_title', function() {
          return get_the_title();
     } );
    

    Then use the shortcode [the_title] to get the title of the post/page/event you are currently on.

    Stephen Harris
Viewing 8 posts - 1 through 8 (of 8 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.