Skip to content

Instantly share code, notes, and snippets.

@peterwegren
Last active December 6, 2016 19:31
Show Gist options
  • Save peterwegren/ea401532879a118fb18685ea4ae3cdac to your computer and use it in GitHub Desktop.
Save peterwegren/ea401532879a118fb18685ea4ae3cdac to your computer and use it in GitHub Desktop.
Waldo - multiple images, single page/template.
<?php
$image = get_field('section_image_1');
$waldo_class = 'section-image-1';
$waldo_styles = $waldo->waldoStylesArray($image, $waldo_class, $waldo_styles, $waldo_class);
$image = get_field('section_image_2');
$waldo_class = 'section-image-2';
$waldo_styles = $waldo->waldoStylesArray($image, $waldo_class, $waldo_styles, $waldo_class);
$image = get_field('section_image_3');
$waldo_class = 'section-image-3';
$waldo_styles = $waldo->waldoStylesArray($image, $waldo_class, $waldo_styles, $waldo_class);
// OR
// use a loop if it makes sense for your page/template
for ($i=1; $i <= 3; $i++) {
$image = get_field('section_image_' .$i);
$waldo_class = 'section-image-' .$i;
$waldo_styles = $waldo->waldoStylesArray($image, $waldo_class, $waldo_styles, $waldo_class);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment