I have created a function in WordPress where I wish to obtain all the images within a given directory, for which I am using the PHP glob function, for some reason I cannot get this to work, is the glob() function disabled for use within WordPress?
The Code that Doesn't Work...
function getAccreditaionLogos(){
define('ACCREDPATH', get_stylesheet_directory_uri() . '/img/accreditations/');
$images = glob(ACCREDPATH . '*.png');
foreach($images as $key => $img):
$get_icons = '<li><img src="'.$img.'" /></li>';
echo $get_icons;
endforeach;
}