Skip Navigation

[Resuelto] New Post Relatsionships API – ‘call to undefined function’

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

Problem:
The new Post Relationships API has landed, very happy to see this:

https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/

Details

CPTs slugs
music-release (Music Release)
music-store (Music Store)

Relationship slug
music-release-music-store

Intermediary CPT slug
music-release-music

Intermediate CPT custom field slug
wpcf-purchase-link

So on my Music Release CPT theme template I want to:

1. Display the purchase link from the intermediary cpt that links the Music Release and the Music Store
2. Display the logo from the Music Store CPT linked to in the relationship, through the intermediary (music-release-music).

Solution:

Types 2.3-b3 (beta 3) indeed didn't include the new public API, it was released only yesterday with 2.3-b4, you can download it here:
https://toolset.com/account/downloads/
Choose channel: Beta

- originally, it was intended to be released both 2.3-b4 and 2.2.22 at the same time, but there have been delays (glitches on the part of the beta version)

And you can use function toolset_get_related_posts(), like this:

$intermediary_posts = toolset_get_related_posts( 
    get_the_ID(), //Post to query by.
    'music-release-music-store',  //Slug of the relationship to query by 
    'parent', //Name of the element role to query by.
    100, //Maximum number of returned results
    0, //Result offset
    array(),//Additional query arguments
    'post_id', //Determines return type
    'intermediary' // which posts from the relationship should be returned
);

Relevant Documentation:

https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/

This support ticket is created hace 6 años, 9 meses. 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.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

Etiquetado: 

Este tema contiene 16 respuestas, tiene 2 mensajes.

Última actualización por Geoffrey Cleverley hace 6 años, 8 meses.

Asistido por: Luo Yang.

Autor
Mensajes
#623198

Here is the feedback from our developers:
Types 2.3-b3 (beta 3) indeed didn't include the new public API, it was released only yesterday with 2.3-b4, you can download it here:
https://toolset.com/account/downloads/
Choose channel: Beta

- originally, it was intended to be released both 2.3-b4 and 2.2.22 at the same time, but there have been delays (glitches on the part of the beta version)

#623205

Great news, I would prefer to stay in the Beta channel...

I have been looking forward to this for a very long time. I will close this now. If I have any problems I'll just open another ticket.

Thanks