Skip Navigation

[Resolved] Setting up post parents to enable wpdatatables

This support ticket is created 6 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+01:00)

This topic contains 1 reply, has 2 voices.

Last updated by Nigel 6 years, 11 months ago.

Assisted by: Nigel.

Author
Posts
#527299

My website has two related post types "company-profile" which is the parent and "ranking-data", the child.

Every month we rank the companies and import the ranking-data scores and other fields for the companies as custom fields to ranking-data.

I have been successfully using WPAllimport to import monthly company ranking data to my WP website to display the data in Company profiles.

I understand that WP-Types uses a hidden custom field to manage the parent-child relationship, in this case "_wpcf_belongs_company-profile_id".

I am now trying to set up a table using WPDatatables to display the data. I am getting the MySQL request written for me. My programmer has told me that for the MySQl request to work I need to use wp_post_parent for ranking-data to enable the ranks to be retrieved from the database.

I have been asked to do this:
"Can you set the "post_parent" value as respected "company_profile" ID for "ranking-data" in "wp_posts" table ?"

I gather this is done via PhPmyadmin...??

If I do change these settings as requested by the developer will this impact on how WP-types operates?

Please advise.

Peter

#527373

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi Peter

The post_parent column in wp_posts is for the built-in WordPress concept of hierarchical posts, which is very different to Types post relationships, and I suspect your developer is confusing the two.

WordPress posts can be hierarchical, individual posts can have parents, where the id of the parent post is stored in wp_posts in the post_parent column. But these relationships are always between posts of the same type (whether relationships between standard posts, or between posts of a custom type, but always the same type).

Types provides a means to create a post hierarchy across post types, which has nothing to do with the built-in post hierarchies. I'm not sure what unintended side-effects you might experience if you try to duplicate the value of _wpcf_belongs_company-profile_id from wp_postmeta to the post_parent column of wp_posts, you would have to try it on a test installation and see.

If you were trying to do that in phpMyAdmin you would be writing a SQL query to do so, and if you have a developer writing a SQL to use in wpDataTables they should be able to write that query for you, too.

But I think it ill-advised. I'm not familiar with wpDataTables but if the idea is that you need to provide the SQL to retrieve the data as required, then you just need a better SQL query which uses table joins to make the required connections between company profiles and ranking data.

I may have may misunderstood what the requirement is for wpDataTables, and I'm no expert in crafting SQL queries either, but I think that is what you should be aiming for.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.