2015-09-09, 07:00:35
PHP Code:
function getImages() {
$folder = get_theme_url(false) . '/assets/images/projects/';
$filetype = '*.*';
$images = glob($folder.$filetype);
$j = 0;
$column1 = array();
$column2 = array();
$column3 = array();
foreach($images as $i){
switch ($j) {
case 0:
$column1[] = $i;
$j = $j+1;//set for next
break;
case 1:
$column2[] = $i;
$j = $j+1;//set for next
break;
case 2:
$column3[] = $i;
$j = 0;//set for next
break;
}
}
foreach($column1 as $i) {
echo $i . "<br />";
}
echo "<div class='imageContainer'>";
echo "<div class='col-3'>";
foreach($column1 as $i){
echo "<img class='project' src='http://localhost/WebDesignerWebsiteCMS/theme/Innovation/". $i."' />";
}
echo "</div>";
echo "<div class='col-3'>";
foreach($column2 as $i){
echo "<img class='project' src='".$i."' />";
}
echo "</div>";
echo "<div class='col-3 last'>";
foreach($column3 as $i){
echo "<img class='project' src='".$i."' />";
}
echo "</div>";
echo "</div>";
}
I put all of the above inside a function, inside the themes_functions.php, and it still does not populate.