WordPress storing complex data

Like here, I need to list all the products (ladies) from each day inserted..

This may be a noob question, but I need an option on how to store complex data in WordPress Products (custom post type). I’m an experienced PHP developer but newbie in WordPress world.

I’m making a plugin “Roster” which will contain recurring events (weekly), so I wanted to store it somehow in database, but I don’t know how to do it so in WordPress.

I tried with add_meta_boxes hook, but don’t know how can I search through post_metas..

For example:

I have a _rooster meta_key with

+------------+-----------+------------+--------------+
|  meta_id   |  post_id  |  meta_key  |  meta_value  |
+------------+-----------+------------+--------------+
|    270     |    180    |   rooster  |   { JSON }   |
+------------+-----------+------------+--------------+

JSON:

{
  "monday": {
    "t1": "05:00-16:00",
    "t2": "18:00-19:00"
  }
}

But I doubt this is correct approach, it would be so easier with multiple tables.. As I learned to do it that way.

And when I get the results for example.. I need all the products that has Monday key, and then list their times. Like a calendar.

Thanks for the help! 🙂

Read more here: WordPress storing complex data

Leave a Reply

Your email address will not be published. Required fields are marked *