localhost TEMPLATEPATH mamp = images not working?
-
I’m using the WordPress constant TEMPLATEPATH to create variables within my functions.php that I use to link to specific images/scripts/etc within my theme’s directory (to help keep it organized). For example:
define('CONDOR_LIB',TEMPLATEPATH . '/lib'); define('CONDOR_ADMIN', CONDOR_LIB . '/admin'); //... other code I'm removing to keep this simple define('CONDOR_ADMIN_IMG', CONDOR_ADMIN . '/img' );
Then these variables would be used like this:
// I include my php file within functions.php like this: require_once(CONDOR_ADMIN . '/admin-aesthetics.php'); // this is an example of its use in admin-aesthetics.php body { background: #000 url(' . CONDOR_ADMIN_IMG . '/login-bg.jpg) top center repeat-x !important; margin: 0; height: 100%;}
Now, that is working *perfectly* fine. Because it will output something like this:
body { background: #000 url(/Applications/MAMP/htdocs/wp-content/themes/lotusDestiny/lib/admin/img/login-bg.jpg) top center repeat-x !important; margin: 0; height: 100%;}
However, that image NEVER shows up though when I’m viewing the website on my localhost. And the image IS there because if I copy>paste that exact path into my browser window, it shows the image as being there.The images aren’t showing up in both Safari and Firefox. It seems like there’s some kind of security issues with loading images from outside the https://localhost environment or something…. I’m just not sure if there’s a way to force TEMPLATEPATH to read from https://localhost instead? Is there a different constant I should be using instead?
I tried searching but the wordpress forums were returning nothing but a blank page and I can’t seem to find any answers through Google to fixing this.
I assume it would work just fine in a live environment, but I don’t want to have to work completely on my live servers when I can build/test so much quicker locally… and of course TEMPLATEPATH makes it infinitely easier to re-use and deploy for future projects…
- The topic ‘localhost TEMPLATEPATH mamp = images not working?’ is closed to new replies.