WordPress tribe events registration

I was using Tribe Events and need a simple event registration solution (no login, just registration). So I came up with a simpel solution using ”WordPress form manger”. Follow these steps if you want a registration form in singel view for Tribe Events:

  1. Install ”WordPress form manager” https://wordpress.org/plugins/wordpress-form-manager/
  2. Create a form called ”registration-form”
  3. Add the fields you need (name, company, phone etc).
  4. Add a field called ”Event name”
  5. Save your form
  6. Go to the tab ”Form extra”
  7. Give the field ”Event name” the following nickname ”eventname”
  8. Save your form
  9. Open your themes ”style.css” add this rule: .fm-item-eventname { display: none; }
  10. Save
  11. Open your themes ”function.php”
  12. Add the code below, save and you are god to go =)

function add_registration_form () {
echo '<h2>Registration for '. strtolower(get_the_title()) .'</h2>';
echo '<input type="hidden" id="name-of-event" value="'.get_the_title().'" />';
echo do_shortcode('[form registration-form]');
echo '<script>
$ = jQuery;
$(function() {
//-- Read name from hidden field that has been printed before form
$(".fm-item-eventname input").val($("#name-of-event").val());