Build a Team Members Block with Photos and Icons PRO

PRO This tutorial uses features of WP Coder Pro. Compare WP Coder and WP Coder Pro Pricing

A Team Members Block with Photos and Icons

A team section is the classic “client-editable block”: the layout is fixed, the people change. You’ll build it once with a Repeater, responsive images and an icon from your Icons library.

You’ll use: Repeater with an image sub-field, image sub-variables, Loop Logic, {{svg.name}} icons.
Time: 15 minutes.


Step 1. Add the icon#

Go to WP Coder Pro → Icons → Add an icon:

  • Name: linkedin
  • Label: LinkedIn
  • SVG code:
    <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M16 8a6 6 0 0 1 6 6v7h-4v-7a2 2 0 0 0-2-2 2 2 0 0 0-2 2v7h-4v-7a6 6 0 0 1 6-6z"/><rect width="4" height="12" x="2" y="9"/><circle cx="4" cy="4" r="2"/></svg>

    Save. The icon is cleaned and added to the site’s sprite file icons.svg.

Step 2. Make sure Loop Logic is on#

Tools → Site Tools → Enable Loop Logic.

Step 3. The fields#

New snippet Team. Attributes:

Attribute name Field type Default value Label
heading Text (single line) Meet the team Heading
members Repeater (list of items) photo:image,name:text,role:text,linkedin:url People

Step 4. The HTML#

<section class="team">
  <h2 class="team__heading">{{$heading}}</h2>
  <ul class="team__grid">
  <Loop field="members">
    <li class="team__card">
      {{loop.photo_html}}
      <h3 class="team__name">{{loop.name}}</h3>
      <p class="team__role">{{loop.role}}</p>
      <If field="linkedin" operator="not_empty" value="">
        <a class="team__link" href="{{loop.linkedin}}" aria-label="{{loop.name}} on LinkedIn">{{svg.linkedin.color}}</a>
      </If>
    </li>
  </Loop>
  </ul>
</section>
  • {{loop.photo_html}} prints a complete responsive <img> with srcset, sizes, width, height and alt text from the media library — WordPress decides lazy or eager loading.
  • The <If> inside the loop is checked per person: the LinkedIn link appears only when it is filled in.
  • {{svg.linkedin.color}} prints the icon from the sprite; .color makes it follow the CSS color.

Step 5. The CSS#

.team__heading { text-align: center; margin-block-end: 32px; }
.team__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.team__card { text-align: center; }
.team__card img {
  width: 160px;
  height: 160px;
  object-fit: cover;
  border-radius: 50%;
}
.team__name { margin: 16px 0 4px; font-size: 18px; }
.team__role { margin: 0 0 8px; color: #64748b; }
.team__link { color: #0a66c2; }
.team__link:hover { color: #004182; }
.team__link .wpc-svg { width: 22px; height: 22px; }

Save without Display Rules — the snippet is placed as a block.

Step 6. Fill it in#

Add the WP Coder Snippet block to the About page, choose Team, and add people in the People field: pick a photo from the media library, type the name, role and LinkedIn URL. Reorder rows by dragging.


Variations#

  • Let editors pick an icon per person — add a sub-field icon:library_icon:color and print {{loop.icon}}. Editors then choose from your icon library in the block.
  • Hero image above the grid — an Image (with preload) attribute cover and {{$cover_html_high}}: the image is preloaded and gets fetchpriority="high".
  • Show it on several pages — the same snippet, different people per block. Change the design once, every page follows.