items.php 1.24 KB
Newer Older
Benthe Kuijpers's avatar
Benthe Kuijpers committed
1
2
3
4
5
6
7
8
9
10
11
12
13
<?php
$layout = get_sub_field('layout');
?>
<div class="content-row items-row items-row--<?php echo $layout; ?>">
	<div class="container">
		<h3><?php the_sub_field('title'); ?></h3>
		<?php
		if (have_rows('items')) : ?>
			<div class="grid grid--medium">
				<?php while (have_rows('items')) : the_row(); ?>
					<div class="item">
						<?php
						$image = get_sub_field('img');
Benthe Kuijpers's avatar
Benthe Kuijpers committed
14
						$crop = get_sub_field('img_crop');
Benthe Kuijpers's avatar
Benthe Kuijpers committed
15
						if( $image ) {
Benthe Kuijpers's avatar
Benthe Kuijpers committed
16
							echo '<div class="img img--' . $crop . '">' . wp_get_attachment_image( $image, 'medium' ) . '</div>';
Benthe Kuijpers's avatar
Benthe Kuijpers committed
17
18
19
20
						} ?>
						<div class="item__content">
							<h3><?php the_sub_field('title'); ?></h3>
							<?php the_sub_field('description');
21

Benthe Kuijpers's avatar
Benthe Kuijpers committed
22
							$link = get_sub_field('text_link');
23
24
25
26
27
28
29
30
31
32
							if( $link ):
							  $link_url = $link['url'];
							  $link_title = $link['title'];
							  $link_target = $link['target'] ? $link['target'] : '_self';
							  echo '<a href="' . esc_url( $link_url ) . '" target="' . esc_attr( $link_target ) . '" class="text-link ';
							  if ($link_target === '_blank') {
							  	echo 'text-link--external';
							  }
							  echo '">' . esc_html( $link_title ) . '</a>';
							endif; ?>
Benthe Kuijpers's avatar
Benthe Kuijpers committed
33
34
35
36
37
38
39
						</div>
					</div>
				<?php endwhile; ?>
			</div>
		<?php endif; ?>
	</div>
</div>