1

I am using Custom post types in one of my themes

I have one custom post type called "accommodation" with meta boxes to add details such as type of rooms (single, twin, double...); each room has a price according to different season (high season, low season, peak season - each could be ). However the room types could differ among individual "accommodation" post entries (suppose one has a room called "de luxe", another has a room type "budget", not just single, twin double), and not all entries have the same rooms (ie some could not have a "dorm" type), therefore the admin should be able to manually insert different types of rooms. Each room should have a price too. And each room could have price variation according to season. Season period should be defined with a range date picker. Additionally, there could be multiple high/low season within the year.

How would you arrange this?

thanks a lot for any help!

4
  • There's a lot going on to answer here so I'd think about breaking it up a bit. In a nut shell you need to look into date pickers that can let you define the seasons via a settings page and then think about using taxonomies to categorise the different rooms. Commented Nov 1, 2011 at 13:05
  • I see, but the seasons wouldn't be the same for every entry. Each "accommodation" entry could have theirs. Anyway, back to the original question to add/duplicate custom metas in general, is there a straight answer to this? (suppose the meta is just a simple string of text... let's forget about dates, since they involve datepickers and perhaps this complicates things as you also point out) - thanks !
    – unfulvio
    Commented Nov 1, 2011 at 14:25
  • I'm not entirely sure what you're asking still. Do you need to know how to create additional meta boxes on the custom post type edit screen or how to save the post meta or something else? Are you asking how best to build the form for entering the information? Commented Nov 1, 2011 at 14:34
  • Yes. I know how to create a standard meta box, but I want to add dynamically new fields and fieldsets from backend admin. Imagine there's a fieldset with fields "room" and "room price", how to add more rooms and prices (more fieldsets) with an "add another room" button? I suppose data could be saved in an array, I just wanted to know if there was some ready solution, plugin to be used or some guide I could use to learn how to. Thanks
    – unfulvio
    Commented Nov 2, 2011 at 8:37

2 Answers 2

2

I will answer myself after some research :)

while there might be appropriate ways of coding this with some custom function, for me there's no need to reinvent the wheel when there's a neat plugin that does the job

it's called "advanced custom fields"

http://wordpress.org/extend/plugins/advanced-custom-fields/

it has a "repeater" to let admins add more fields dynamically

it also manages datepicks and fieldsets... basically everything I need!

hope this is helpful to others

1

You must have a look at http://wordpress.org/extend/plugins/custom-fields-creator/

not neat as "advanced custom fields" but it does the job and its free of charge as well.

Hope it will be useful for others

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.