Skip to content

Instantly share code, notes, and snippets.

@brycejacobson
Created May 4, 2020 17:08
Show Gist options
  • Save brycejacobson/47676453ad8c5d2980409702fdc66bc8 to your computer and use it in GitHub Desktop.
Save brycejacobson/47676453ad8c5d2980409702fdc66bc8 to your computer and use it in GitHub Desktop.
ACF Fields with no Coding Standards
<?php if ( $phone = get_field('phone') ): ?>
<?php echo esc_html($phone); ?>
<?php endif; ?>
<?php if ( $email = get_field('email') ): ?>
<a href="mailto:<?php echo $email; ?>"><?php echo $email; ?></a>
<?php endif; ?>
<?php echo esc_url(get_field('website')); ?>
<?php
$images = get_field('images');
if( $images ): ?>
<?php foreach( $images as $image ): ?>
<a href="<?php echo esc_url($image['url']); ?>">
<img src="<?php echo esc_url($image['sizes']['thumbnail']); ?>" alt="<?php echo esc_attr($image['alt']); ?>"/>
</a>
<?php endforeach; ?>
<?php endif; ?>
<?php if( have_rows('add_another_location') ): ?>
<?php while( have_rows('add_another_location') ): the_row(); ?>
<?php if ( $address = get_sub_field('address') ): ?>
<?php echo esc_html($address); ?>
<?php endif; ?>
<?php if ( $city = get_sub_field('city') ): ?>
<?php echo esc_html($city); ?>
<?php endif; ?>
<?php if ( get_sub_field('state') == 1 ) : ?>
<?php endif; ?>
<?php if ( $zip = get_sub_field('zip') ): ?>
<?php echo $zip; ?>
<?php endif; ?>
<?php if ( $phone = get_sub_field('phone') ): ?>
<?php echo esc_html($phone); ?>
<?php endif; ?>
<?php endwhile; ?>
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment