{% if posts or title or text %}
 
    {% set archiveLink = fn.get_post_type_archive_link('team') %}
    <section class="m_panel" m-pack="premium">
      {% include 'm_components/widgets/headline.twig' with {
        title : title,
        text: text,
        link: archiveLink
      } 
      only %}
  
  {% if posts %}

    <div class="grid">
      {% for item in posts %}

        {% set related_title = item.post_title %}
        {% set terms = fn.wp_get_post_terms(item.ID, 'function', {'fields': 'names'} ) %}

        {% set related_time = item.post_date|date('Y-m-d') %}

        {% set image = fn.get_post_thumbnail_id(item.ID) %}

        <a href="{{fn.get_the_permalink(item.ID)}}" class="m_panel__block">
          <div class="m_panel__image">
            {% include 'm_components/widgets/picture.twig' with {image: image, title: title} only %}
          </div>
          <div class="m_panel__content">

            <h2 class="h4">{{item.m_first_name}} {{item.m_last_name}}</h2>
            <small>
              {% if terms %}
                {{terms|join(', ')}}
              {% endif %}
            </small>
          </div>
        </a>

      {% endfor %}
    </div>

    {% endif %}

    {% if archive %}
      {% include 'm_components/widgets/link.twig' with {
        textBtn : "View more",
        link: archiveLink
      }
    only %}
    {% endif %}
  </section>
{% endif %}
