Skip Navigation

[Gelöst] How to link content of custom post types

Dieser Thread wurde gelöst. Hier ist eine Beschreibung des Problems und der Lösung.

Problem: I would like to be able to easily display information from another post. Should I use post relationships here?

Solution: Yes, this case is ideal for a parent-child (one-to-many) post relationship.

This support ticket is created vor 3 Jahre, 3 Monate. There's a good chance that you are reading advice that it now obsolete.

Dies ist das technische Support-Forum für Toolset – eine Suite von Plugins zur Entwicklung von WordPress-Websites ohne PHP-Pogrammierung.

Jeder kann in diesem Forum lesen, aber nur Toolset-Kunden können darin Beiträge veröffentlichen. Der Toolset-Support arbeitet 6 Tage pro Woche, 19 Stunden pro Tag.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 2 Antworten, has 2 Stimmen.

Last updated by romanF vor 3 Jahre, 3 Monate.

Assigned support staff: Christian Cox.

Author
Artikel
#1667251

In my case, I have let's say "companies" as one custom post type and the second custom post types are the offers these "companies" offer on my page. I started simply creating these two custom post type but now I started listing these "offers" and face the problem that I can't add the name or the logo of the company since I list the offers not the companies.
I could simply add all information about the companies to the offers. This is not ideal since this info would be needed to be inserted each time a new offer is added.

What would be a smart way to solve this. Can I make the offer a child of the company the get the information into the list?
What would you recommend?

Thank you for your help!

#1667447
Screen Shot 2020-06-17 at 3.25.14 PM.png

Hello, welcome to Toolset! Yes, that is correct. I recommend creating a one-to-many post relationship between Companies and Offers. If you set Offers as the child post type and Companies as the parent post type in a One-to-Many post relationship, you will be able to easily access information from the parent Company post in a list (a View) of Offer posts. If you are using the Block Editor to build a list of Offers, you can insert a custom field, like a logo image, to display information from the parent Company. Insert a Toolset Image Block and choose "Dynamic source", then select a parent post field. See the attached screenshot for an example, and let me know if you have additional questions about this.

#1670449

My issue is resolved now. Thank you!

Das Forum „Toolset Professioneller Support“ ist für neue Themen und Antworten geschlossen.