Repeating item layouts should use CSS Grid with a CSS custom property for the column count. This guarantees exact N-per-row columns without flexbox hacks.
Correct Grid Pattern
// render.php — pass column count as CSS custom property
<div class="wpt-logo-bar__logos" style="--logo-cols:<?php echo esc_attr($logo_cols); ?>">
/* style.css — CSS grid consumes the custom property */
.wpt-logo-bar__logos {
display: grid;
grid-template-columns: repeat(var(--logo-cols, 3), 1fr);
gap: var(--wpt-logo-bar-gap, var(--wpt-spacing-xl));
align-items: center;
}
This guarantees exactly N logos per row. Additional items wrap to the next row automatically. Never use flex-wrap: wrap with max-width hacks to approximate column counts.