Crazy CSS image path problem using a relocated CSS file
-
So let me try and explain this as clearly as I can.
I am attempting to build a website that utilizes WordPress only for its home page and news archive. All the other pages of my site will be standard HTML with PHP includes for common elements like the header and footer. They won’t be WordPress powered, but I’ll be keeping them in the WordPress root directory for the sake of organization.
Since these pages, WordPress powered or not, are going to look the same, I decided they should share the same style sheet. However, since WordPress requires its CSS file to exist in the theme’s folder, and I don’t want to be using a theme’s CSS file for all my other non-wordpress powered pages, I created a secondary CSS file in a folder called “styles” in the root WordPress install. I am keeping all my site’s styles in that CSS file and only using the theme’s CSS file so that WordPress recognizes my PHP files as a theme.
I am also keeping all my site images in an images folder in the root WordPress install, as opposed to the theme’s images folders, because I don’t want all my non-wordpress pages to have to point to images in a themes folder.
Now the problem I’m having lies in the file path to my images in my relocated CSS file.
Early in my site development I had the CSS file in the theme folder, with image paths like “../../../images/header.gif” so it would point to the images folder in the root directory. Now that I’m moving all my site styles to this new style sheet file and out of the theme, I updated my image paths accordingly- to “images/header.gif”.
However, it breaks my images! Even though the style sheet is located one folder into the root WordPress install, just like my images folder, it’s acting like it still exists in my Theme folder.
What in the world is going on? The image path pointing three folders up should NOT be working. But it does!
Does WordPress somehow alter CSS image paths even though I’m using a CSS file that isn’t technically part of the theme anymore?
I’d really appreciate some help with this. Hopefully my explanation of what I’m trying to do makes sense. If not, ask me and I’ll try and clarify. Thanks!
- The topic ‘Crazy CSS image path problem using a relocated CSS file’ is closed to new replies.