Page is a not externally linkable
- Code, Content, and Presentation
-- WordPress
---- CSS in child displaying diff in home/page vs Post/category


rocknbil - 4:54 pm on Dec 23, 2011 (gmt 0)


It's because you're using relative links. You need to make them relative to root (or at least, relative to your working directory.)

Look at your working page URL:
example.com/occupy/dev/wp/

And the CSS:

'wp-content/themes/occupation/images/Box-gld-sbar-lowres.png'

We can presume the Wordpress index.php is here

example.com/occupy/dev/wp/index.php

OK? So it's finding the image at

example.com/occupy/dev/wp/wp-content/themes/occupation/images/Box-gld-sbar-lowres.png

Then you go into the category.

example.com/occupy/dev/wp/category/news/regional

So the browser expects you're in a directory from wp, category/news/regional (even though that's not a real directory). so it's looking for the image relative to where you are, here

example.com/occupy/dev/wp/category/news/regional/wp-content/themes/occupation/images/Box-gld-sbar-lowres.png

Which, of course, doesn't exist.

When it's "live" you'd find it easiest to do this,

'/wp-content/themes/occupation/images/Box-gld-sbar-lowres.png'

Note the leading slash. That would mean "start at the domain root and follow this path." It would work for any "virtual" subdirectory.

But since you're in a dev environment, you'll have to do something else, like

'/occupy/dev/wp/wp-content/themes/occupation/images/Box-gld-sbar-lowres.png'

... which may be difficult if you have lots of such references. It looks like you're assigning this in the admin widget, so that might be the best solution. For your CSS, do a search and replace for all images in the same way, like so

background:url(/occupy/dev/wp/wp-content/themes/occupation/images/some-bg-image.jpg) top left no-repeat;


Thread source:: http://www.webmasterworld.com/wordpress/4400711.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com