0

Does anyone know why the following returns nothing?

<?php 
    $dir = get_bloginfo('template_directory') . "/documents/*";
    foreach(glob($dir) as $file) {
        echo $file;  
    }
?>

I have files in the documents folder...

Thanks in advance!

0

get_bloginfo('template_directory') returns a URI and I believe glob works with paths so try:

$dir =  get_theme_root() . "/documents/*";
foreach(glob($dir) as $file) {
    echo $file;  
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.