In a Metabox View that displays related posts (set using relationship), how can I have the view not display if there are no related posts set? The MB View is being added to a custom post template using an MNB Views shortcode. It includes a heading, and even if there are no related posts, the heading is currently displaying. I want the whole view (including the headline) to not display if there are no related posts.
Here is an example to check if there is a related post then display the heading.
{% set relationship = attribute( relationships, 'post-to-page' ) %}
{% set posts = relationship.to %}
{% if posts is not empty %}
My heading here
{% for post in posts %}
{{ post.title }}
{% endfor %}
{% endif %}