Saltar navegación

[Resuelto] Link 2 CPTs

Este hilo está resuelto. Aquí tiene una descripción del problema y la solución.

Problem:

You want to link "Documents" (CPT) to "Events" (CPT) so that certain documents can be associated with specific events and displayed dynamically on an event's page.

Solution:

One-to-Many Relationship:

- Use this if each Document is linked to only one Event.
- Example: A single Document can only be associated with one Event.

Many-to-Many Relationship:

- Use this if a Document can be linked to multiple Events and an Event can have multiple Documents.
- Example: Shared resources like policies or templates across multiple events.

Relevant Documentation:

https://toolset.com/course-chapter/using-post-relationships-on-directory-sites/

https://toolset.com/related-lesson/post-relationships/

This support ticket is created hace 6 meses, 2 semanas. 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.

Este tema contiene 1 respuesta, tiene 1 mensaje.

Última actualización por Christopher Amirian hace 6 meses, 2 semanas.

Asistido por: Christopher Amirian.

Autor
Mensajes
#2787873

I am currently building a new website and they have 2 main types of info. On the one hand Documents (title, description, author and a link to a pdf) and on the other hand Events (most likely via The Events Calendar). Both are displayed on different pages, so you can consult both the Documents and the Events.

Some documents must be linked to certain events and in order to avoid uploading the same Documents to (different) Events, I am wondering if in the Events CPT, can we select Documents from a dropdown to link them to that Event and then create a loop that extracts a Custom Field of each Document and display that in a View?

So an Event will have its title, description, date, ... and then an

    with the link to the pdf from the linked Documents.
#2788403

Christopher Amirian
Colaborador

Idiomas: Inglés (English )

Hi,

Welcome to Toolset support. It seems that you need a relationship between the two post types in question.

But you need to decide if the relationship will be one-to-many or many-to-many.

You can learn more about relationships here:

https://toolset.com/course-chapter/using-post-relationships-on-directory-sites/

For a more detailed study you can check the lessons below:

https://toolset.com/related-lesson/post-relationships/

Thanks.