Okay
  Public Ticket #2947394
Display Data From Two Custom Post Types In Same Row
Closed

Comments

  • Jonathan Roper started the conversation

    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

  •  1,819
    Miloš replied

    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).

    8889428134.png

    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

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia 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