Skip to content

Instantly share code, notes, and snippets.

@krasenslavov
Last active April 26, 2020 15:41
Show Gist options
  • Save krasenslavov/4434e38434759448ef1a907a38e611ac to your computer and use it in GitHub Desktop.
Save krasenslavov/4434e38434759448ef1a907a38e611ac to your computer and use it in GitHub Desktop.
Create Gutenberg Blocks with ACF 5.8+ PRO. Visit blog post https://bit.ly/2Y8el2X
<?php
$class_name = 'demo';
if (!empty($block['className'])) {
$class_name .= ' ' . $block['className'];
}
if (!empty($block['align'])) {
$class_name .= ' align' . $block['align'];
}
?>
<div class="<?php echo esc_attr($class_name);?>">
<div class="grid">
<div class="cell">
<?php if (have_rows('venues')):?>
<table>
<?php while (have_rows('venues')) : the_row();?>
<tr>
<td width="40%" valign="top">
<p><img src="<?php echo get_sub_field('photo')['sizes']['large'];?>" /></p>
<p>
<strong>Date:</strong> <?php the_sub_field('date');?><br />
<strong>Ticket price:</strong> <?php the_sub_field('ticket_price');?>
</p>
</td>
<td valign="top">
<h4>
<?php the_sub_field('name');?>
</h4>
<p>
<big><?php the_sub_field('venue');?></big><br />
<em>
<?php the_sub_field('address');?>,
<?php the_sub_field('city');?>
<?php the_sub_field('state');?>,
<?php the_sub_field('postal_code');?>,
<?php the_sub_field('country');?>
</em>
</p>
<p>
<?php the_sub_field('short_description');?>
</p>
</td>
</tr>
<?php endwhile;?>
</table>
<?php endif;?>
</div>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment