Tag Archives: custom fields

Custom fields for events

There are several good plugins that allow one to create custom fields (or indeed one can just add the fields yourself manually!).

The events plugin has no easy way of knowing what custom fields have been created and how they should be displayed.  See the bear hunt approach below. Custom fields could be

  • images?,
  • urls?,
  • boolean values where the displayed value is something else – maybe the field name?
  • maybe an array – the result of a multi choice select
  • an array of non homogenous values…

Add the custom fields to the post content

Ideally the plugin that creates the custom fields also provides a way to add them to the post content, especially if there is special formatting involved (which the events plugin would not know about).  This is what the sharing and social media plugins do… add stuff to the post content.

The events plugin applies all shortcodes and filters to the content, so the creating plugins shortcodes or filters should work to includes those custom fields in the post content.

If the plugin you are using does NOT offer a way to add the info, then you could consider a site specific plugin where you add your own filter or shortcode to display the values however you want them displayed.

Add custom fields elsewhere in the events list

If adding the custom fields to the post content is not ok, then you need some advanced php smarts (or my custom services -:) ).   The plugin offers a multitude of filters and pluggable functions where you can add code to do your own thing.

Not recommended unless your needs are truly not satisfiable in other ways: You could even write your own listing function – receive the list of events, including post id’s and list it all anyway you want, looking up any additional data.

Reinvent the wheel

An option being considered is ‘reinventing the wheel’ – basically adding own feature to add custom fields. At least then this plugin would know what the fields are and how they should be formatted.   This may be available in a future.

Integrate?

Another option is to pick ‘best of breed’ and deep integrate with an existing plugin.    This would put the events plugin at the mercy of change and updates to the other plugin and doesn’t get around the problem that some users will want to use other plugins anyway.

Still thinking about this one.

The difficult way… I’m not afraid…

Colour in sheet courtesy of scholastic books
There is a ‘difficult’ way that the events plugin could offer these other fields to you to design where you want them in the events list. I call it ‘going on a bear hunt’ and have done this in the amr-users plugin for user reporting.  It has a lot of overhead both in admin settings and run time.

“There is no way around it, gotta go through it” – the entire meta table would have to be searched through to find all the fields that could exist for a post type. It can only find what data is already created.  It still has no way of knowing how they should be formatted.  In the wordpress user reporting plugin it does a best guess and offers some options.

The events plugin may do something similar in the future, note it is not a small task.

If you’d like to have a say on this, either comment here, or add a feature request note in the forum.