[insert_php]
function mtimecmp($a, $b) {
$mt_a = filemtime($a);
$mt_b = filemtime($b);
if ($mt_a == $mt_b)
return 0;
else if ($mt_a < $mt_b)
return -1;
else
return 1;
}
function get_files($images_dir_array, $tags, $exts = array('jpg', 'png')) {
$files = array();
$times = array();
for ($i = 0; $i
$times[] = filemtime($images_dir . ‘/’ . $file);
}
closedir($handle);
}
}
array_multisort($times, SORT_DESC, $files);
return $files;
}
[/insert_php]
$file_display = array(‘jpg’,’png’,’mp4′,’pdf’);
$counter = 0;
echo ‘
$dirs = [‘wp-content/uploads/2016/icsaludable/img/consejos’, ‘wp-content/uploads/2016/icsaludable/img/activacion’, ‘wp-content/uploads/2016/icsaludable/img/ejercicios’, ‘wp-content/uploads/2016/icsaludable/img/recetas’, ‘wp-content/uploads/2016/icsaludable/img/nutricampechada’, ‘wp-content/uploads/2016/icsaludable/img/platicainteligencia’];
$tags = [«consejo», «activacion», «ejercicio», «receta», «nutricampechada», «platicainteligencia»];
$str = «»;
$dir_contents = get_files($dirs, $tags);
foreach ($dir_contents as $filex) {
$file = $filex[«name»];
$tag = $filex[«tag»];
$dir = $filex[«dir»];
$file_type = strtolower(end(explode(‘.’, $file)));
if ($file !== ‘.’ && $file !== ‘..’ && in_array($file_type, $file_display) == true) {
list($width, $height) = getimagesize(«https://wordpress.instcamp.edu.mx/wp-content/uploads/2016/icsaludable/$dir/$file»);
$classH = «»;
if ($width < $height) { $classH = "item2"; } if ( $tag == "nutricampechada") { //echo "«;
echo «
«;
}
else if ( $tag == «platicainteligencia») {
echo «
«;
}
else {
echo «
«;
}
}
}
echo ‘
‘;
echo ‘‘;
[/insert_php]