Insert form into event details ?

This topic contains 2 replies, has 2 voices, and was last updated by  andytc 10 years, 3 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #9417

    Hi , I’ve had a request from a site that uses event organiser and I’m not sure if this is possible.

    They would like to have a form placed on the events detail page for a specific category.

    The form will be from Formidable or Gravity , not sure which one at the moment. It will include checkboxes , email , acceptance of some terms etc which will be mailed to the site owner.

    Playing around with contact form 7 , it’s easy enough to put a shortcode on the event manually , but how could this be achieved automatically when that category is selected?

    Also , the event title would have to be included somewhere in the email from the form.

    Also , when I added the shortcode to the event details , it worked , but the sidebar event widget showed the event details as normal but with the the raw shortcode for contact form 7 showing as well.

    Just looking for some clues as to the easiest way to accomplish this.

    andytc
    #9427

    Hi Andy,

    I’d recommend editing the event-meta-event-single.php template for this (remember to copy it your theme first). This template is used for the event details section. This is (by default) prepended to the event’s content – so if you’d rather have it after the content, I’d recommended making a copy of single.php, naming it event-single.php and then adding the line

    <?php eo_get_template_part('event-meta','event-single'); ?>

    wherever you want the event details, and then adding do_shortcode(...) whether you want the form to appear. Using do_shortcode() here is a bit of hack though and whichever form plug-in you decide to go with, they’ll probably have some sort of function that would render a form you specify by an ID (for example). If so, its better to use that.

    If you want to check if an event is in a category you can do the following:

     if( has_term( 'my-cat-slug', 'event-category' ) ){
         //Event is in event category 'my-cat-slug'
     }

    As for including the event title in the e-mail form – ideally you’d want to include the event ID in the form details which is then submitted. The form plug-in presumably as someway of you programatically changing the content of the e-mail message based on what data was received. I’m afraid, how you include that event ID in the data, and then how you retrieve that data and use it in the admin notification will depend very on the plug-in you end using. You’ll have to consult the plug-in’s documentation to determine how you’d do that.

    Hope that helps :).

    Stephen Harris
    #9433

    Thanks Stephen , great support as always 🙂

    I know my way around the templates pretty well now , I had to edit them to display nicely using the Genesis framework , so I’ll play around and see what I can achieve.

    Thanks again

    andytc
Viewing 3 posts - 1 through 3 (of 3 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.