Tell us what you are trying to do?In general when I want to detect if there are related posts i use this function and then I registered a shortcode. If this shortcode is 1 then there are related posts. like in this formula
add_shortcode( 'parent-post_video_musicale', 'parent_post_video_musicale_func' );
function parent_post_video_musicale_func( $atts ) {
Thank you for getting in touch. Given that you are using the toolset_get_related_posts() function, it would imply that you wrote this code for Many to Many or One to Many relationships.
Even if the relationship is One to One, there is a Parent and a child. The first post type that is selected will be considered as the Parent and the second post type will be the child.
I tried to use "get_related_post" but it doesn't work
with this function so I have an ID
$parent_posts = toolset_get_related_post( get_the_ID() , 'post_video_musicale', 'child' );
how can I say that id is not equal to 0 but !=empity so to make the shortcode
parent-post_video_musicale
equal to 1?
Notice i've change toolset_get_related_posts() to toolset_get_related_post()
Also when you add the shortcode [parent-post_video_musicale] to your parent posts it will check if that parent post has a child and return 1 if there is a child post. Remember that the parent post is the first CPT that was added in the post relationship.
However from what I see on this shortcode it will only work when added to the parent post type. If you want to modify this to be used on both Parent post and Child posts then you will need to allow the shortcode to accept parameters. Like below.
So when you're using the shortcode you will need to specify if you want to check for the Parent or Child. Example [parent-post_video_musicale relationship='child']
Please let me know if my response provided any clarity or if you're still unsure.