Hi guys, I'm trying to create a thumbnail gallery using the following code:
<?php
echo(types_render_field( "vehicle-images", array( "alt" => "Product image",
"width" => "454", "height" => "454", "proportional" => "true", 'index' => 0 ) ));
?>
It's grabbing the thumbnail images perfectly, but the link is out of sync and not linking to the same image as displayed by the thumbnail and I can't figure out why, been racking my brains over it for a while now so would really appreciate some help.
Cheers
Ignore that code, my copy and pasting skills failed. The code I'm refering to is:
<?php $images = get_post_meta(get_the_ID(), 'wpcf-vehicle-images');
for ($index = 0; $index < count($images); $index++) {
$image = $images[$index];
$thumb = types_render_field('vehicle-images', array('index' => $index, 'width' => '105', 'proportional' => 'true'));
echo '<div class="span3"><a href="' . $image . '">' . $thumb . '</a></div>';
}
?>
Dear James,
There is an extra meta key holding the order that you aren't processing. Can you try with this code instead?
<?php $images = get_post_meta(get_the_ID(), 'wpcf-vehicle-images');
for ($index = 0; $index < count($images); $index++) {
$image = types_render_field('vehicle-images', array('index' => $index, 'raw' => 'true', 'proportional' => 'true'));
$thumb = types_render_field('vehicle-images', array('index' => $index, 'width' => '105', 'proportional' => 'true'));
echo '<div class="span3"><a href="' . $image . '">' . $thumb . '</a></div>';
}
?>
Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.
Regards,
Caridad