I essentially have two custom post types called "slot" and "session". Each "slot" then has four fields called "A" "B" "C" & "D" where then I am then providing the ID of the session. The idea is then that each slot can have up to 4 sessions.
What I'm now looking to do is have WpDataTables show a table of slots with the associated sessions. However, my question is if the slots are only being given ids of the associated sessions, is there a way for WpDataTables to be able to get the associated session posts and then display the data I need from those posts, or is this not possible? If it is, then could you provide a little guidance regarding how to do this?
If it's not possible, then if I gave each session a datetime field, is there a way I can get wpDataTables to create each row based on the different datetimes that are provided rather than the actual WordPress post? This seemed more complicated compared to the 1st option but I could be wrong.
- Could you try to give us a bit more detail about how the tables would look like, how would you set up the columns, for the custom posts? Would be best to add screenshots if possible.
-What would you use as the data source, perhaps file-based, or SQL, manual tables?
- Seems to be the best way to accomplish this would be using a foreign key relation, between split tables. You could choose a "store value", to pull a "session ID" from another table, which would be used as a row identifier, and then you could select another column as "display value" (such as any data you need to display from the Post).
Hi there,
I wondered if you could answer a question I have?
I essentially have two custom post types called "slot" and "session". Each "slot" then has four fields called "A" "B" "C" & "D" where then I am then providing the ID of the session. The idea is then that each slot can have up to 4 sessions.
What I'm now looking to do is have WpDataTables show a table of slots with the associated sessions. However, my question is if the slots are only being given ids of the associated sessions, is there a way for WpDataTables to be able to get the associated session posts and then display the data I need from those posts, or is this not possible? If it is, then could you provide a little guidance regarding how to do this?
If it's not possible, then if I gave each session a datetime field, is there a way I can get wpDataTables to create each row based on the different datetimes that are provided rather than the actual WordPress post? This seemed more complicated compared to the 1st option but I could be wrong.
Thanks,
Jonathan
Hi, Jonathan.
Thanks for showing interest in our plugin.
- Could you try to give us a bit more detail about how the tables would look like, how would you set up the columns, for the custom posts? Would be best to add screenshots if possible.
-What would you use as the data source, perhaps file-based, or SQL, manual tables?
Here is a bit of documentation about ways to create tables in wpDataTables - https://wpdatatables.com/documentation/general/table-creation-wizard-overview/
- Seems to be the best way to accomplish this would be using a foreign key relation, between split tables. You could choose a "store value", to pull a "session ID" from another table, which would be used as a row identifier, and then you could select another column as "display value" (such as any data you need to display from the Post).
Here is a documentation section with more details, and a step by step example about using foreign keys with wpDataTables, if you could please take a look - https://wpdatatables.com/documentation/front-end-editing/configuring-table-relations-foreign-key/
- Contact us further if you need more details, or if this was perhaps not what you meant to achieve.
Kind Regards,
Miloš Jovanović
[email protected]
Rate my support
Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables