alex3 Posted May 15, 2009 Share Posted May 15, 2009 I'm having quite the problem that I can't figure out. Here's the code I use: <? require_once("scripts/random.php"); ?> This calls the script in to the document, that's in the <head>, then the actual script (where on a normal site, the path to the handf folder will differ): <?php $f = glob('wp-content/themes/pheonix/images/handf/*/'); $i = $f[array_rand($f)]; ?> My setup for a normal site page is that I have a header.php, index.php (or whatever the content is called), and footer.php. Wordpress doesn't do things too differently. On a normal page, I have a header image and a footer image, like so <img alt="" src="<?="$i";?>header.png"> ... <img alt="" src="<?="$i";?>footer.png"> This means that I get a matching header and footer image, which are two sections of the same photo. This works brilliantly in a normal page. Wordpress, however, won't let it work. It will happily show the header image (which is called for in header.php) but will not display the footer image, which is called for in footer.php. A web browser says that image /footer.png does not exist (where '/' is the root of the Wordpress installation). The only way past this is to call the random.php script again in footer.php, but this is more than less than ideal as the image doesn't match! How can I get this working again? Please say if something's unclear, I tried my best! Link to comment https://forums.phpfreaks.com/topic/158314-retrieving-random-image-sets-in-while-in-wordpress/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.