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 badges1 Answer
Reset to default 1If 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
版权声明:本文标题:ajax - Storing temporary data for a custom post type 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742222786a2435557.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论