<?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,
            }
        }
    });
});
BMW X1 (2017)

BMW sDRIVE20i STEPTRONIC

R 299 950
Range:
X1
Year:
2017
Mileage:
73 299km
Colour:
WHITE
Transmission:
AUTOMATIC
Fuel:
UNLEADED
Vehicle ID:
28297871
Available from Barons Tokai
<?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");
        }
    }
?>
Sales Enquiry - Mastercars

Similar Listings 

https://bmrprodphotosuitestorage.blob.core.windows.net/stockimages/mol01182_u0070813_1.jpg, https://bmrprodphotosuitestorage.blob.core.windows.net/stockimages/mol01182_u0070813_2.jpg, https://bmrprodphotosuitestorage.blob.core.windows.net/stockimages/mol01182_u0070813_3.jpg, https://bmrprodphotosuitestorage.blob.core.windows.net/stockimages/mol01182_u0070813_4.jpg, https://bmrprodphotosuitestorage.blob.core.windows.net/stockimages/mol01182_u0070813_5.jpg, https://bmrprodphotosuitestorage.blob.core.windows.net/stockimages/mol01182_u0070813_6.jpg, https://bmrprodphotosuitestorage.blob.core.windows.net/stockimages/mol01182_u0070813_7.jpg, https://bmrprodphotosuitestorage.blob.core.windows.net/stockimages/mol01182_u0070813_8.jpg, https://bmrprodphotosuitestorage.blob.core.windows.net/stockimages/mol01182_u0070813_9.jpg
BMW
X1
(2021)

BMW MY20 sDRIVE18d xLINE STEPTRONIC

Array ( [vehicleid] => Array ( [0] => 28298269 ) [dumpdate] => Array ( [0] => 2025-09-21T16:53:48.417 ) [mmcode] => Array ( [0] => 05020116 ) [molstockbooknumber] => Array ( [0] => MOL01182_U0070813 ) [stockbooknumber] => Array ( [0] => U0070813 ) [vinnumber] => Array ( [0] => WBA52AC0405T25378 ) [regnumber] => Array ( [0] => ND405935 ) [uploadtype] => Array ( [0] => USED ) [vehiclemake] => Array ( [0] => BMW ) [vehiclerange] => Array ( [0] => X1 ) [vehiclemodel] => Array ( [0] => MY20 sDRIVE18d xLINE STEPTRONIC ) [vehicleyear] => Array ( [0] => 2021 ) [bodytype] => Array ( [0] => STATION WAGON ) [transmissiontype] => Array ( [0] => AUTOMATIC ) [fueltype] => Array ( [0] => DIESEL ) [colour] => Array ( [0] => GREY ) [numberofdoors] => Array ( [0] => 5 ) [mileage] => Array ( [0] => 99230 ) [servicehistory] => Array ( [0] => Full ) [comments] => Array ( [0] => Optional Extras Included - Multi Function Steering Wheel - Electric Windows - Leather Seats - Alloy Wheels - Front and Rear PDC - Reverse Camera - FA Multi Award winning flagship at the heart of KZN. We offer nationwide deliveries or an option to make it a holiday and fly to us to experience our amazing city with beautiful beaches and amazing weather. Experience exceptional customer service and professionalism from our qualified sales executives and management team. All ads are subject to inhouse fin ) [price] => Array ( [0] => 359950 ) [dealershipid] => Array ( [0] => 35 ) [molnumber] => Array ( [0] => MOL01182 ) [dealershipname] => Array ( [0] => Barons Durban ) [pictures] => Array ( [0] => a:9:{i:0;s:90:"https://bmrprodphotosuitestorage.blob.core.windows.net/stockimages/mol01182_u0070813_1.jpg";i:1;s:90:"https://bmrprodphotosuitestorage.blob.core.windows.net/stockimages/mol01182_u0070813_2.jpg";i:2;s:90:"https://bmrprodphotosuitestorage.blob.core.windows.net/stockimages/mol01182_u0070813_3.jpg";i:3;s:90:"https://bmrprodphotosuitestorage.blob.core.windows.net/stockimages/mol01182_u0070813_4.jpg";i:4;s:90:"https://bmrprodphotosuitestorage.blob.core.windows.net/stockimages/mol01182_u0070813_5.jpg";i:5;s:90:"https://bmrprodphotosuitestorage.blob.core.windows.net/stockimages/mol01182_u0070813_6.jpg";i:6;s:90:"https://bmrprodphotosuitestorage.blob.core.windows.net/stockimages/mol01182_u0070813_7.jpg";i:7;s:90:"https://bmrprodphotosuitestorage.blob.core.windows.net/stockimages/mol01182_u0070813_8.jpg";i:8;s:90:"https://bmrprodphotosuitestorage.blob.core.windows.net/stockimages/mol01182_u0070813_9.jpg";} ) [nmi_vehicle_id] => Array ( [0] => WBA52AC0405T25378 ) ) 1
WBA52AC0405T25378
WBA52AC0405T25378
Colour: GREY
MOL01182
28298269

Enquire

Contact Form
<?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");
        }
    }
?>
R 359 950
99 230km
2021
AUTOMATIC
More details