1// LOOP
2
3<?php if( have_rows('hero') ): ?>
4 <?php while( have_rows('hero') ): the_row();
5
6 // Get sub field values.
7 $image = get_sub_field('image');
8 $link = get_sub_field('link');
9
10 ?>
11 <div id="hero">
12 <img src="<?php echo esc_url( $image['url'] ); ?>" alt="<?php echo esc_attr( $image['alt'] ); ?>" />
13 <div class="content">
14 <?php the_sub_field('caption'); ?>
15 <a href="<?php echo esc_url( $link['url'] ); ?>"><?php echo esc_attr( $link['title'] ); ?></a>
16 </div>
17 </div>
18 <style type="text/css">
19 #hero {
20 background-color: <?php the_sub_field('color'); ?>;
21 }
22 </style>
23 <?php endwhile; ?>
24<?php endif; ?>
1<?php
2
3// BASIC GROUP
4
5$hero = get_field('hero');
6if( $hero ): ?>
7 <div id="hero">
8 <img src="<?php echo esc_url( $hero['image']['url'] ); ?>" alt="<?php echo esc_attr( $hero['image']['alt'] ); ?>" />
9 <div class="content">
10 <?php echo $hero['caption']; ?>
11 <a href="<?php echo esc_url( $hero['link']['url'] ); ?>"><?php echo esc_html( $hero['link']['title'] ); ?></a>
12 </div>
13 </div>
14 <style type="text/css">
15 #hero {
16 background-color: <?php echo esc_attr( $hero['color'] ); ?>;
17 }
18 </style>
19<?php endif; ?>