admin管理员组

文章数量:1332403

I've created a Rental custom post type for a rental site I'm developing for a client. I'd like to add an ajax availability calendar in the backend so the client can mark/unmark unavailable dates clicking on them, such as this:

I need to temporary store the marked dates somewhere so they don't get lost when the client moves through months back and forth. I'm wondering if using transients is the best option for this. Any ideas?

Thanks in advance

I've created a Rental custom post type for a rental site I'm developing for a client. I'd like to add an ajax availability calendar in the backend so the client can mark/unmark unavailable dates clicking on them, such as this:

I need to temporary store the marked dates somewhere so they don't get lost when the client moves through months back and forth. I'm wondering if using transients is the best option for this. Any ideas?

Thanks in advance

Share Improve this question edited Jul 29, 2020 at 22:40 leemon asked Jul 13, 2014 at 10:41 leemonleemon 2,0324 gold badges25 silver badges51 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

If you're using custom post types, i'd save those date entries as post_meta entries (http://codex.wordpress/Function_Reference/add_post_meta). So if your client clicks on a date, you start an ajax request to your plugin/theme file to add or remove a meta entry.

you can create one meta_entry named _availability for example and save all dates there (you can save multiple meta_entries to a post with the same name <= 1:n)

saving your dates as meta entries has the additional benefit that you can start a WP_Query that shows you all properties available today very easily.

br from salzburg,

  • Johannes

本文标签: ajaxStoring temporary data for a custom post type