ACF Fields
<?php if(get_field('taxonomy_field_name')): ?>
<?php $terms = get_field('taxonomy_field_name'); ?>
<ul>
<?php foreach($terms as $term): ?>
<h2><?php echo $term->name; ?></h2>
<p><?php echo $term->description; ?></p>
<a href="<?php echo get_term_link($term); ?>">View all '<?php echo $term->name; ?>' posts</a>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php $color = get_field('media_text_color', $image['ID']); ?>
<?php if(get_field('about_sections_gallery')): ?>
<?php $images = get_field('about_sections_gallery'); ?>
<div class="gallery">
<?php foreach($images as $image): ?>
<img src="<?php echo $image['sizes']['thumbnail']; ?>" alt="<?php echo $image['alt']; ?>" />
<?php endforeach; ?>
</div>
<?php endif; ?>
<?php if(get_field('image')): ?>
<?php $image = get_field('image'); ?>
<img src="<?php echo $image['sizes']['medium']; ?>" alt="<?php echo $image['alt']; ?>" />
<?php endif; ?>
<?php if(get_field('relationship_field_name')): ?>
<?php $posts = get_field('relationship_field_name'); ?>
<div class="carousel">
<?php foreach($posts as $post): // variable must be called $post (IMPORTANT) ?>
<?php setup_postdata($post); ?>
<div class="slide">
<a href="<?php the_permalink(); ?>">
<?php the_title(); ?>
</a>
</div>
<?php endforeach; ?>
</div>
<?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>
<?php endif; ?>
<?php if(get_field('field')): ?>
<?php the_field('field'); ?>
<?php endif; ?>
<?php if(have_rows('repeater_field_name')): ?>
<div class="slides">
<?php while(have_rows('repeater_field_name')): the_row(); ?>
<div class="slide">
<?php the_sub_field('content'); ?>
</div>
<?php endwhile; ?>
</div>
<?php endif; ?>
<?php if(get_field('prices_link')): ?>
<?php
$link = get_field('prices_link');
$link_url = $link['url'];
$link_title = $link['title'];
$link_target = $link['target'] ? $link['target'] : '_self';
?>
<a class="btn" href="<?php echo esc_url($link_url); ?>" target="<?php echo esc_attr($link_target); ?>">
<?php echo esc_html($link_title); ?>
</a>
<?php endif; ?>
<?php if(get_field('layout_events')): ?>
<?php $featured_posts = get_field('layout_events'); ?>
<div class="carousel">
<?php foreach($featured_posts as $featured_post): ?>
<?php
$permalink = get_permalink($featured_post->ID);
$title = get_the_title( $featured_post->ID );
$custom_field = get_field('field_name', $featured_post->ID);
?>
<div class="slide">
<a href="<?php echo esc_url($permalink); ?>">
<?php echo esc_html($title); ?>
</a>
<?php echo esc_html( $custom_field ); ?>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>