So, I've got the Slides JS correctly set-up but I want to create a PHP code to list files from a directory, if possible by modified date first.
This is the code that I've got so far:
Which from my understanding should list the .jpg images in the directory as:
But it's not listing anything - do i need to add this as a function to wordpress?
Secondly, how can I list the images by modified date, is this possible?
URL: msc-media.co.uk
This is the code that I've got so far:
Code:
<div id="slides">
<div class="slides_container">
<?php
$directory = "/wp-content/themes/1/img/";
$images = glob("" . $directory . "*.jpg");
$imgs = '';
foreach($images as $image){ $imgs[] = "$image"; }
foreach ($imgs as $img) {
echo "<div>
<img src='$img' />
</div> ";
}
?>
</div>
</div>
Which from my understanding should list the .jpg images in the directory as:
Code:
<div>
<img src="image_src_here.jpg" />
</div>
But it's not listing anything - do i need to add this as a function to wordpress?
Secondly, how can I list the images by modified date, is this possible?
URL: msc-media.co.uk