Support

Home Forums Custom Files Adding default Event Meta Keys to Meta Box

Adding default Event Meta Keys to Meta Box

Posted: March 21, 2013 at 12:05 pm

Viewing 2 reply threads


David Kerr

    March 21, 2013 at 12:05 pm

    Hi,

    I’m trying to make it easier for a client to enter custom meta keys on the Event Overview page. I’d just like to add “display_price” and “multiple_day_event” as boxes after “event_hashtag”, “event_format” and “event_livestreamed” as defaults so my client doesn’t need to remember the spelling/format of each key name when entering them for the first time.

    Could anyone explain how I’d do it please? Thanks!

    Version 3.1.30.7P and WP 3.5.1 fwiw


    Josh

      March 21, 2013 at 12:54 pm

      Hi David,

      You can use the custom files add-on to do this. You’ll first want to upload the custom_functions.php file to the /wp-content/uploads/espresso/ directory. More information here:

      http://staging.eventespresso.com/wiki/custom-files-addon/

      Then you can add something like this after the opening php tag:

      if (!function_exists('ee_default_event_meta')){
          function ee_default_event_meta(){
              return array(
                  "event_hashtag"=>"#campvibes",
                  "event_format"=>"jamboree",
                  "event_livestreamed"=>"N",
                  "display_price"=>"Y",
                  "multiple_day_event"=>"N"
              );
          }
      }
      

      The above code was adapted from example code you can find in this section of the documentation:

      http://staging.eventespresso.com/wiki/shortcodes-template-variables/#ee-meta


      David Kerr

        March 21, 2013 at 1:29 pm

        Awesome, thanks Josh, works like a charm.

        Viewing 2 reply threads

        The support post ‘Adding default Event Meta Keys to Meta Box’ is closed to new replies.

        Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

        Event Espresso - Staging Server