I have two cpts, TRAININGS and TRAINING EVENTS. These are related in a one-to-many relationship. In TRAINING EVENTS single I want to insert a view of those events that are held in the same city, CITY being a custom field of TRAINING EVENTS. So in the query filter I should specify that CITY equals to constant CITY OF CURRENT POST. But how do I specify city of current post?
1. In the "Query Filter" section of your view, you can include a custom field filter for the city field, that is a "String" and is "equal to" the "Shortcode attribute" named "city".
Example Screenshot: hidden link
2. Next, you can update your view's shortcode, to include this new attribute "city" and the current post's city value like this:
I re-read my older support threads. The problem is that in Divi library items you cannot use shortcode within shortcode because the inner shortcode doesn't get interperted. In my case the city attribute. It was simpler for me to use divi libraries and assign them as templates in CPT layout injector than using the same finctionality in Toolset. But I try it now the toolset-only way for this single. I get back with the result.
But this surely is an annoying bug, and I don't know if it's Divi's or Toolset's. Do you know about this?
Thanks for writing back and for sharing the update.
If shortcodes within shortcodes are working through Toolset, but not through the DIVI's library items, this suggests that this is a limitation at DIVI builder's end. You can report this to their official support team for possible improvement or workaround.
Using parent="@training-training-planificat.parent" attribute in the view's shortcode, shows that we need some information from the parent in the relationship, but doesn't specify exactly which info is needed.