WebDevStudios / CMB2-Date-Range-Field

20 stars 9 forks source link

Added the possibility to split values into separate meta fields #9

Closed rasmustaarnby closed 8 years ago

rasmustaarnby commented 8 years ago

By splitting the values and saving them as separate meta values, the start date and end date can be used to sort and filter the posts in WP_Query.

rasmustaarnby commented 8 years ago

I initially just used the sanitize method and update_post_meta but realized that it probably the wrong place to save data and that it would only support post objects. I have now placed the functionality in it's own method and are using the cmb2_save_field, where I have the whole field object and thus access to all required data for actions, objects and values.

rasmustaarnby commented 8 years ago

Just realized you might want to wait with the pull request till version 2.2.0 of CMB2 is out. I'm relying on a hook that's not introduced until that version.