You do it the same way as you would adding extra fields to other post types:
- Add action add_meta_boxes and define fields
- Add action save_post and save custom data with add_post_meta() and update_post_meta()
Hope that helps!
Thread Starter
coss
(@coss)
Thanks! I am unclear on where to define this.
You would do that in functions.php of your theme. A third step would be necessary:
3. Show field data in your template using get_post_meta().
But actually there is an more easy way, in the case you are not comfortable with php code. You could use WordPress custom fields.
Thread Starter
coss
(@coss)
The custom fields aspect adds nothing to the page, unfortunately. I’ve filled it in, but nothing appears. I’ve added “Age Range”, but nothing appears.
http://www.sparkevents.ca/events/event/draft-created-april-28-2014-1104-pm/
You have to output the content of your custom fields in your template. So if you want to show “age range” on the event template, the easiest way would be to add this to your single-event.php:
the_meta()
This outputs all custom fields. If you want to output only one, you should do something like that:
get_post_meta( get_the_ID(), 'age_range', true );