WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Local host not calling local css (9 posts)

  1. miromiro
    Member
    Posted 7 years ago #

    I installed WP on my server (no problem, worked a treat) and then downloaded XAMPP to install a local version to work on my home machine (XP).

    After some blundering around it seemed to work, however, it only loads style.css from the remote server - so if I edit my local style sheet, I don't see any changes on localhost until I upload it to the server. Worse, if I am offline, the site displays on localhost unstyled.

    I have a basic grasp of what is going wrong, but can't find a fix. I would appreciate any help offered.

  2. ZMAng
    Member
    Posted 7 years ago #

    If it only loads style.css from the remote server, I believe this must mean that your template is still calling your stylesheet from your remote server. I can only presume that perhaps your stylesheet location has been given an absolute URL.

    To remedy this, modify your Header template so that your stylesheet is called from your localhost. Here's the relevant line of code:

    <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />

    Normally <?php bloginfo('stylesheet_url'); ?> will automatically give you your localhost stylesheet. But if even this fails, try giving it an absolute URL to your localhost stylesheet, e.g. http://local.yourwordpressinstall.com/wp-content/themes/yourtheme/style.css.

  3. miromiro
    Member
    Posted 7 years ago #

    Thanks for the reply, ZM.

    Partial fix: it loads style.css but not navigation.css. I tired an absolute url (local) there but no joy.

    Or is it just a case of needing to run two versions on my local machine - one for dev and one to synchronize with the remote server?

    Cheers

  4. Doodlebee
    Member
    Posted 7 years ago #

    is your navigation.css in a subfolder?

    Should look like so:

    <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />

    <link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/css/navigation.css" type="text/css" media="screen" />

    If it's not in a subdirectory, but the same level as the style.css, then remove that "/css" I put in there.

  5. miromiro
    Member
    Posted 7 years ago #

    Thanks doodlebee,

    No, it is all pointing where it should: /navigation.css"

    Cheers,

  6. Chris_K
    Member
    Posted 7 years ago #

    I'm curious: what URI's are specified at Options -> General?

  7. miromiro
    Member
    Posted 7 years ago #

    Hi Handy,

    absolute uri's: http://www.domain.org.nz/blog/

    Does that help? Or do I have to have a seperate instance of WP installed locally with local uris?

    Cheers,

  8. vkaryl
    Member
    Posted 7 years ago #

    I run local copies of all my own and client blogs using xampp. I've found you have to have the local uris or it borks.

    I also run local databases; I've not tried accessing the online databases.... hmmm. Wonder if that would work.... hmmm. Might have to try it....

  9. miromiro
    Member
    Posted 7 years ago #

    Thanks vkaryl,

    Yeah, it was a conclusion that was becoming more and more evident to me (I guess I was just in denial about it).

    Cheers,

Topic Closed

This topic has been closed to new replies.

About this Topic