I'm making a theme and want to insert a simple 'if' statement for the image.
Basically, if there's a file "image.jpg" in "my_theme/img/", it'll echo 'Apples', otherwise - 'Oranges':
Code: Select all
<!--IMAGE EXISTS--> <?php if (file_exists('bl-themes/my_theme/img/image.jpg')): ?> <?php echo "Apples" ?> <?php endif ?> <!--IMAGE DOESN'T EXIST--> <?php if (!file_exists('bl-themes/my_theme/img/image.jpg')): ?> <?php echo "Oranges" ?> <?php endif ?>
The image is here:
Works well on localhost (with that filepath), although when I upload it to a web server, it doesn't seem to find the image no matter how hard I try to describe the path (the image is there, obviously, but I must be missing something very simple). Tried using THEME_DIR_IMG, HTML_PATH_THEME_IMG, HTML_PATH_ROOT, nothing works on a web server. I'm getting confused, though it must be something silly that I've missed.
Thanks in advance!