Skip to content

Instantly share code, notes, and snippets.

@slimndap
Created June 24, 2015 07:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slimndap/31f1d1d6d5a2c4256f0c to your computer and use it in GitHub Desktop.
Save slimndap/31f1d1d6d5a2c4256f0c to your computer and use it in GitHub Desktop.
Adds a new 'Doors open' field to the event editor. For a more information see: http://www.slimndap.com/a-new-event-editor/.
/**
* Adds a 'Doors open' field to the event editor.
*
* Prepends the new field by filtering the current fields of the event editor
* using the 'wpt/event_editor/fields' hook.
*
* @param array $fields The current fields of the event editor.
* @param int $event_id The ID of the event being edited.
* @return array The new fields of the event editor.
*/
function add_doors_open_field($fields, $event_id) {
array_unshift( $fields, array( 'id' => 'doors_open', 'title' => 'Doors open' ) );
return $fields;
}
add_filter( 'wpt/event_editor/fields', 'add_doors_open_field', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment