Skip to content

Instantly share code, notes, and snippets.

@NielsPilon
Created November 29, 2018 13:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NielsPilon/5075dc06bb15c730cb62316226506208 to your computer and use it in GitHub Desktop.
Save NielsPilon/5075dc06bb15c730cb62316226506208 to your computer and use it in GitHub Desktop.
ACF Gutenberg block
<?php
/**
* Block Name: Testimonial
*
* Het template bestand wat we gebruiken voor ons Testimonial block
*/
// afbeelding veld ophalen (array)
$avatar = get_field('afbeelding');
// id attribuut aanmaken voor specifieke styling
$id = 'repeater-' . $block['id'];
// uitlijnings class aanmaken ("alignwide") vanuit de blok instellingen ("wide")
$align_class = $block['align'] ? 'align' . $block['align'] : '';
?>
<blockquote id="<?php echo $id; ?>" class="testimonial <?php echo $align_class; ?>">
<p><?php the_field('quote'); ?></p>
<cite>
<img src="<?php echo $avatar['url']; ?>" alt="<?php echo $avatar['alt']; ?>" />
<span><?php the_field('naam'); ?></span>
</cite>
</blockquote>
<style type="text/css">
#<?php echo $id; ?> {
background: <?php the_field('achtergrondkleur'); ?>;
color: <?php the_field('text_color'); ?>;
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment