Valeriia
Fils de soutien créés au cours des 30 derniers jours : 0
Sujets de forum favoris
This user has no favorite topics.
Sujets de forum créés
Status | Sujet | Supporter | Voix | Publications | Nouveauté |
---|---|---|---|---|---|
Make the date field display the day of the week?
Commencé par : Valeriia in: Toolset Professional Support |
2 | 3 | Il y a 6 années et 7 mois | ||
Get post parent with new Post Relationships API (php)
Commencé par : Valeriia
in: Toolset Professional Support
Problem: I would like to get the parent post Course of the current post Product using the new Post Relationships API, but it doesn't seem to be working. I have tried both of these syntaxes: $course = toolset_get_parent_post_by_type( $product, 'course' ); $courses = get_posts( array( 'post_type' => 'course', 'numberposts' => -1, 'toolset_relationships' => array( 'role' => 'parent', 'related_to' => $product_id, 'relationship' => array( 'course', 'product' ) ), ) ); Solution: In this case, the relationships were created in the new system, so toolset_get_parent_post_by_type is not appropriate. The toolset_get_parent_post_by_type API is intended for use with legacy relationships, or relationships that were migrated from the legacy system. When specifying the relationship to query, the array syntax is intended for legacy relationships as well. The best approach in this case is to use the toolset_get_related_posts API, and the relationship slug instead of the post type slug array: $product = get_post(69); $course = toolset_get_related_post( $product, 'your-relationship-slug', 'parent'); Relevant Documentation: |
2 | 7 | Il y a 6 années et 8 mois | ||
PHP notice on the site with BuddyPress after last update
Commencé par : Valeriia in: Toolset Professional Support |
2 | 5 | Il y a 8 années et 3 mois |