<?php
$post_id = get_the_id();
// echo print_r(get_vehicle_gallery_images());
$image_urls = get_post_meta($post_id, 'pictures', true);
if (is_string($image_urls)) {
$images = explode(',', $image_urls);
} elseif (is_array($image_urls)) {
$images = $image_urls;
} else {
$images = [];
}
if (!empty($images)): ?>
<div class="vehicle-gallery">
<?php foreach ($images as $index => $img_url): ?>
<a href="<?php echo esc_url(trim($img_url)); ?>" class="glightbox" data-gallery="vehicle-gallery">
<?php if ($index === 0): ?>
<img src="<?php echo esc_url(trim($img_url)); ?>" alt="Vehicle Image" class="gallery-main-image" />
<?php else: ?>
<img src="<?php echo esc_url(trim($img_url)); ?>" alt="Gallery Thumb" class="gallery-thumb" />
<?php endif; ?>
</a>
<?php endforeach; ?>
</div>
<?php endif; ?>
document.addEventListener('DOMContentLoaded', function () {
new Swiper('.vehicle-gallery', {
slidesPerView: 5,
spaceBetween: 10,
loop: true,
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
breakpoints: {
768: {
slidesPerView: 3,
},
480: {
slidesPerView: 2,
}
}
});
});
HYUNDAI VENUE (2022)
HYUNDAI 1.0 TGDI MOTION
R 249 950
Range:
VENUE
Year:
2022
Mileage:
57 255km
Colour:
SILVER
Transmission:
MANUAL
Fuel:
UNLEADED
Vehicle ID:
28460959
Available from Barons Pietermaritzburg
<?php
$post_id = get_the_id();
$custom_fields = get_post_meta($post_id);
echo $custom_fields['mmcode'][0] . '<br />';
echo print_r($custom_fields);
if (empty($custom_fields)) {
error_log("No custom fields found for post ID: $post_id");
return;
}
error_log("Custom fields for post ID $post_id:");
foreach ($custom_fields as $key => $value) {
// $value is always an array
if (is_array($value)) {
foreach ($value as $val) {
error_log("$key => $val");
}
} else {
error_log("$key => $value");
}
}
?>Call Now
Available from Barons Pietermaritzburg
9 Armitage Rd, Town Hill, Pietermaritzburg, 3201, South Africa

