WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: The Events Calendar] Feature/Help Request: Customizable Entries/Meta Data in New Event Form (5 posts)

  1. wlanni
    Member
    Posted 4 years ago #

    I'm building out a site including an event/show calendar for a local music venue in Seattle.

    I've installed The Event Calendar, and have hacked it to match my template, etc.

    However, there are fields of information that music show events require. I have two feature requests and one basic help request:

    1. a list of venues to be entered in the control panel that could be selected in the form, in case the events are always at the same place or couple places? (currently no venue shows up if not entered, which is just fine as well)
    2. Would you consider adding the following fields to the form? (You may find many other people needing this info as well):
      • Radial:
        • All Ages/Bar with ID
        • Over 21
      • input field for Advanced Ticket Price (similar to your current price)
      • input field for Door Ticket Price (in replacement of price?)
      • input field to enter advanced ticket url
      • input field to enter Event Home Site url (like to facebook event, or a website that may be dedicated to the event)
    3. HELP! I'd love the ability to be able to customize the current form, or at least get in and hack the meta data. Is that a matter of copying over one of the files into my theme's 'events' directory and hacking something?

    Thanks!

  2. wlanni
    Member
    Posted 4 years ago #

    OK, I'm making the attempt to hack the calendar to add my own meta data in. If anyone else has done this, or has input, I'd appreciate it. I've got a teeny bit of experience hacking plugins to do my bidding, but this is a bit more than I've ever done.

    Here's my plan:

    1. Find the meta tag array (DONE: Line 32 in the-events-calendar.php)
    2. TO DO: Add the meta tags I need (I need to finalize out all the info the club needs, basically most of it is listed in my previous post)
    3. TO DO: Update the calendar's interface function to add input fields when a new post is being created to account for info being added for those new meta tags
    4. TO DO: Update the calendar's grid, list and single event display pages grab the meta data and display it for users

    Question: Best practice on editing WordPress plugins? I figure I should NOT alter the original the-events-calendar.php. Should I use the Edit Plugins area to make these edits? And document so when the next upgrade happens, I can go back in and re-apply my edits? Or do I copy over the the-events-calendar.php file to the events directory in my theme to make these changes?

  3. wlanni
    Member
    Posted 4 years ago #

    OK Progress! I would love feedback on how to do this so that when the next update happens I don't lose all this work. Currently, only the public viewable files live in my themes folder. I tried copying events-meta-box.php into my theme/events but the calendar didn't register any changes to it.

    So basically the-events-calendar.php and events-meta-box.php still reside in the plugin directory, and I'm assuming updates will wipe my changes. GRRR! I have suggestions on that, I'll post them after this:

    I'll run through what I did:

    1. Added custom meta data to the array in the-events-calendar.php at line 46:
      ///** CUSTOM!*/
      '_EventAdvCost', //advanced ticket cost
      '_EventAdvURL', // advanced ticket url
      '_EventAge', //event age (21 or over? all ages?)
    2. Added functions to initialize and return the meta as strings at line 1497 (I created blank spaces):
      /** CUSTOM!
      * Returns Advanced Cost
      *
      * @return string advanced cost
      */
      function the_event_advanced_cost( $postID = null) {
      	if ( $postId === null || !is_numeric( $postId ) ) {
      		global $post;
      		$postId = $post->ID;
      	}
      	return get_post_meta( $postId, '_EventAdvCost', true );
      }
      /** CUSTOM!
      * Returns Advanced URL
      *
      * @return string advanced url
      */
      function the_event_advanced_url( $postID = null) {
      	if ( $postId === null || !is_numeric( $postId ) ) {
      		global $post;
      		$postId = $post->ID;
      	}
      	return get_post_meta( $postId, '_EventAdvURL', true );
      }
      /** CUSTOM!
      * Returns Age
      *
      * @return string Age
      */
      function the_event_age( $postID = null) {
      	if ( $postId === null || !is_numeric( $postId ) ) {
      		global $post;
      		$postId = $post->ID;
      	}
      	return get_post_meta( $postId, '_EventAge', true );
      }
    3. Updated the interface in events-meta-box.php at about line 357 (created new line) to add my custom advanced cost meta (at the moment I've only done advanced ticket cost, as the advanced url will have all kinds of special characters, and the age is going to be a radial, so I don't know how that is going to work yet):
      <!-- !CUSTOM -->
      <tr>
      	<td><?php _e('Advanced Ticket Cost:',$this->pluginDomain); ?></td>
      	<td><input tabindex="2029" type='text' name='EventAdvCost' size='6' value='<?php echo $_EventAdvCost; ?>' /></td>
      </tr>
      <tr>
      	<td></td>
      	<td><small><?php _e('Leave blank to hide the field. Enter a 0 for events that are free.', $this->pluginDomain); ?></small></td>
      </tr>
      <!-- /!CUSTOM -->
    4. Updated /themes/[my theme directory]/events/single.php to add the advanced ticket cost information, line 26:
      <!--CUSTOM!-->
      <?php if ( the_event_advanced_cost() ) : ?>
      	<dt><?php _e('Adv. Tix:', $spEvents->pluginDomain) ?></dt>
      	<dd><?php echo the_event_advanced_cost(); ?></dd>
      <?php endif; ?>
      <!--/Custom!-->

    So, again, I haven't added in the other fields (the url for advanced ticket url, or the age restriction), and if I need to do anything weird to get them to work I'll post back here. Otherwise, follow the example above.

  4. wlanni
    Member
    Posted 4 years ago #

    FEATURE REQUEST/SUGGESTION!
    Please make it so any of the files we move from /plugins/wp-events-calendar/views into /themes/[my theme]/events to custom edit are read into the plugin. Specifically events-meta-box.php, in my case, but any file for future customization.

    Please allow for a check against a custom functions.php in the /themes/[my theme]/events that uses hooks or filters? I am using Thematic, and all of my theme customizations are done in a functions.php that modifies Thematic's built in functions, all using hooks and filters. This way all my customizations are kept separate from the theme's files, keeping updating safe.

    I'll post these into new feature request posts as well.

  5. Shane Pearlman
    Modern Tribe
    Posted 4 years ago #

    We have been debating how to allow people to add custom meta fields. My preference would be to integrate with a custom meta plugin (there are a bunch).

    Nice work! For the short term, you did the only thing you can do, and you will have to manually upgrade come 1.6. Not terrible but not beautiful.

Topic Closed

This topic has been closed to new replies.

About this Topic