<?php

$image = _get_sub_field('mtm_list_item_image');
$url = mtm_output_url_override_sub('mtm_list_item_link');
$file = _get_sub_field('mtm_list_item_file');
$content_size = '-full';
?>

<article class="mtm-list--single">

	<?php 
if ($image) {
    $content_size = '';
    $thumb = $image['sizes']['medium_large'];
    $alt = $image['alt'];
    ?>

		<section class="mtm-list--image">
			<figure class="post--thumbnail">
				<?php 
    if ($url) {
        ?>
<a href="<?php 
        echo esc_url($url);
        ?>
"><?php 
    }
    ?>
					<img src="<?php 
    echo esc_url($thumb);
    ?>
    $j = 1;
    ?>

	<div class="mtm-home-buttons">

		<?php 
    while (have_rows('mtm_home_button_repeater')) {
        the_row();
        // Loop through each item
        ?>

			<a class="button mtm-button home-button home-<?php 
        echo $j++;
        ?>
" href="<?php 
        echo esc_url(mtm_output_url_override_sub('mtm_home_button_link'));
        ?>
"><?php 
        the_sub_field('mtm_home_button_label');
        // sub field value goes here
        ?>
</a>
		
		<?php 
    }
    ?>

	</div>

<?php 
}
<?php

global $mtm_home_feature_count;
?>

<div class="mtm-home-featured--single <?php 
echo mtm_count_classes($mtm_home_feature_count);
?>
">
	<div class="mtm-home-featured--single-content">
		
		<?php 
$image = _get_sub_field('mtm_home_featured_image_manual');
$imageAlt = get_field('mtm_default_featured_image', 'option');
$url = mtm_output_url_override_sub('mtm_home_featured_content_link_manual', 'mtm_home_featured_content_link_custom');
if ($image) {
    $thumb = $image['sizes']['medium_large'];
    $alt = $image['alt'];
    ?>

			<a href="<?php 
    echo esc_url($url);
    ?>
">
				<figure class="post--thumbnail mtm-home-featured--image"><img src="<?php 
    echo esc_url($thumb);
    ?>
" alt="<?php 
    echo esc_html($alt);
    ?>
" /></figure>