<?php
if ( get_theme_mod( 'rebeccafood_promo_boxes_show' ) ) {
    ?>
    <div class="rebeccafood-promo-boxes">
        <div class="row">
            <?php for ( $i = 1; $i <= 3; $i++ ) { ?>
            <div class="col-md-4">
                <div class="promo-box-item">
                    
                    <?php
                        $image_id = attachment_url_to_postid( esc_url( get_theme_mod( "rebeccafood_promo_box_image_{$i}" ) ) );
                        echo wp_get_attachment_image( $image_id, 'medium', false, array(
                            'sizes' => '(max-width: 575.98px) calc( 100vw - 24px ),
                                (max-width: 767.98px) 516px,
                                (max-width: 991.98px) 216px,
                                (max-width: 1199.98px) 296px,
                                (max-width: 1399.98px) 356px,
                                416px'
                        ) );
                    ?>
                    <a href="<?php echo esc_url( get_theme_mod( "rebeccafood_promo_box_link_{$i}" ) ); ?>">
                        <?php echo esc_html( get_theme_mod( "rebeccafood_promo_box_title_{$i}", __( 'Box', 'rebeccafood' ) . ' ' . $i ) ); ?>
                    </a>
                </div>
            </div>
            <?php } ?>
        </div>
    </div>
    <?php
}
