Thanks all of you for the latest release with updated relationships, which is fantastic. I expect you'll be pretty busy right now with support requests, but just one thing – previously I had a custom shortcode that could be used to check for the existence of a child post before outputting code in my view. With the new relationships is there a simpler way of doing this, where there is no intermediary post type?
So basically I'm creating the content template for post type A, and I have a section where it displays which posts of type B it is connected to, but only if it has any such connections.
Any code that you created related to "simple" queries like this one should proceed to work on relationships that were created before the new updates.
If you were to create new relationships, then I suggest using the new API for them.
This is elaborated here:
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/
You can use (for example) the function toolset_get_related_post(), and if the returned result is "zero", you know there are no related posts.
That could as well be returned in a ShortCode, and used in conditionals, or used directly as a conditional source in an HTML condition (if you register the function in Toolset > Settings)
But actually, if you just create a View that displays the connected posts and insert it into your Content Template, that View already takes care of the "nothing found" case, in the Loop.
Might it be much easier to just style the "No items found" section of the view?
Thanks so much Beda, you're right, it was easiest just to take all of the surrounding code in to the view and leave the "no items found" section blank.