Skip Navigation

[Resolved] Need some advice on best setup for site with post relationships

This thread is resolved. Here is a description of the problem and solution.

Problem:
What general advice would you have for creating a new site that has a hierarchy of post relationships?

Solution:
Post relationships are changing with the imminent release of Types 3.0.

Read more about what's involved here: https://toolset.com/documentation/post-relationships/

This support ticket is created 6 years, 8 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.

Our next available supporter will start replying to tickets in about 8.97 hours from now. 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+00:00)

This topic contains 4 replies, has 2 voices.

Last updated by Brad Tipper 6 years, 8 months ago.

Assisted by: Nigel.

Author
Posts
#625149

Tell us what you are trying to do?

Just after some advice on the best way to set up a new section of my site.

What I want to do is to enable users to add their "cars" (so will be a post type) then have a series of other post types underneath (as child posts I guess). Things like a maintenance log, parts list etc. My query is how i'd be best to set it up so that users can have multiple cars, and view the various maintenance tasks/parts etc attached to that car?

Cheers!

#625329

Nigel
Supporter

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

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

Hi Brad

For a new project like this I would recommend you check out the betas (available from your wp-types.com/account/downloads page by switching to the beta channel) which feature completely revised functionality and UI for adding post relationships.

They are a work-in-progress but nearing completion (there will be further updates next week and the stable versions are expected early next month).

You can connect different post types, e.g. cars to logs and parts, and then when viewing one post, e.g. a car, display content from the connected posts.

There is a new section of documentation that covers this: https://toolset.com/documentation/post-relationships/

Do you want to read through that and then let me know if you have any questions?

#626103

Hi Nigel,

Thanks for getting back to me- that's really helpful. Still a couple of questions though (assume you guys are still working on the documentation). I've managed to make some good progress.

Ideally, I want to break everything out into sub-sections.

At the moment, I have a view set up that lists all a users cars, and a form that allows them to add new ones.

When viewing a car, I want users to be able to click a link that will take them to a sub-page with just that post type on it - say a page exists at /car-name/maintenance/ that has a view containing all of the maintenance tasks that relate to that particular car, as well as a form to add new maintenance tasks.

I want to do this because the lists under the various post types (maintenance log, parts list etc) are going to get really long, and I don't want a huge scrolling page- it just wouldn't work.

Are you able to point me in the right direction to achieve that? Should be smooth sailing once I've got this last little piece sorted. Cheers!

#626602

Nigel
Supporter

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

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

Hi Brad

Sorry for the delay getting back to you, it was a long weekend here in Ireland.

You can create a page to display maintenance posts—all maintenance posts—that includes a filter to limit what maintenance posts are shown to only those that belong to a particular car.

Which car you pass as a URL attribute.

So on the page that displays the car, you add a link to the maintenance page and append the ID of the car with a URL parameter using the wpv-post-id shortcode, e.g.

<a href="[wpv-bloginfo show='url']/maintenance/?carid=[wpv-post-id]">Maintenence list for this car</a>

The name of the URL parameter doesn't matter as long as you use the same in the link and in the filter in your View.

The principles are described here: https://toolset.com/documentation/user-guides/passing-arguments-to-views/

If you need to re-use the car ID on the maintenance page you can output it with the wpv-search-term shortcode (https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-search-term) so that you can output a link back to the car page, or output fields from the car page by using it as an id attribute, e.g.

<a href="[wpv-post-url id='[wpv-search-term param='carid']']">Return to [wpv-post-title id='[wpv-search-term param='carid']']</a>
#626830

Perfect, thanks. Seems to be working fine now.