Ok, I have a feeling I’ve really done it this time. I’ve developed a WordPress site locally and then transferred it to my remote server. I did a search and replace on the database using the script.
Now, I go into my site on the remote server and the HTML is good, but the CSS stylesheet is not linking properly.
Here is how it appears when I view source:
<link rel="stylesheet" type="text/css" media="all" href="www.fairchildwebsolutions.com/jesusandg/wp-content/themes/Sky/style.css" />
Now when I click on the link in source, I am directed to this:
www.fairchildwebsolutions.com/jesusandg/www.fairchildwebsolutions.com/jesusandg/wp-content/themes/Sky/style.css
Obviously, one too many domain names in there, so the file cannot be found. My question now is, how do I go back and do a search and replace on this to remove the extra domain without messing things up even worse?
Without the http:// it thinks its a local link not direct.
WordPress can also link to the stylesheet or theme directory:
Here is some more information on the function to call out the theme directory: http://codex.wordpress.org/Function_Reference/get_template_directory
when you add the stlyesheets in your functions.php try to stay away from using exact links and instead use the get_template_directory_uri (or something like that i can’t remember the syntax exactly. it’s referenced here WordPress codex for template directory
Add
http://
to the beginning of your stylehref
. Alternatively, since it appears you are on the same domain, simply modify thehref
to be the following:The former is an absolute path. The latter is an absolute path relative to your domain root.
Your stylesheet call is missing its
http://
at the beginning of thehref
. This means the browser interprets it as a relative path not an absolute one and breaks the link.What does your stylesheet call say (probably in
header.php
)? It should be something like:The
get_stylesheet_directory_uri()
call returns the absolute path of the theme directory.If it’s not in
header.php
it’s probably referenced infunctions.php
using thewp_enqueue_script()
function. Same deal – useget_stylesheet_directory_uri()
or one of the several template tags that do the same thing and make sure that is used to build the url to the stylesheet rather than defining it explicitly.