imho, @goto10 is right to use ‘get_bloginfo()’ – i missed that with my suggestion ??
@misterpatrick67
can you clarify with an example of absolute file paths what you tried to get as ‘permalink’ in your first post?
if it is:
https://www.mysite.com/wp-content/themes/mytheme
(which is basically get_bloginfo('template_url')
)
then the ideas in this snippet might get you further:
<?php
echo get_bloginfo('template_url'); echo '<br/>';
echo get_bloginfo('url'); echo '<br/>';
$directory = str_replace(get_bloginfo('url'),'',get_bloginfo('template_url')); // remove the root url
$directory = substr($directory,1,strlen($directory)-1); //remove the leading slash /
echo 'directory: '.$directory; echo '<br/>';
$files = glob($directory.'/images/*.jpg');
foreach($files as $file) {
echo $file;
echo '<br/>';
// make an array of the images
$img_lib[] = str_replace($directory.'/images/','',$file); //remove the path from file
}
?>
(the echos are only to show at any point what is found)
hope this helps a bit, good luck ??