Support » Fixing WordPress » How to use one stylesheet for several blogs?

  • Resolved deko

    (@deko)


    I have several WP blogs each with the exact same theme. Each is installed in its own folder, like this:

    public_html/wp01
    public_html/wp02
    etc. etc.

    It’s working fine, but I would like to centralize whatever I can, especially the stylesheet.

    In the header.php files I see this:

    <?php bloginfo('stylesheet_url'); ?>

    Is there anyway I can modify whatever this is so everything points to public_html/style.css ?

    Thanks in advance.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Chris_K

    (@handysolo)

    You could change
    <?php bloginfo('stylesheet_url'); ?> in the theme files to be an absolute url to the one common stylesheet.

    deko

    (@deko)

    There are a couple of problems with that idea, but yes, that’s one way. An better way woud be to redefine that tag/variable somehow – if I knew how…

    deko

    (@deko)

    I tried hard-coding the path to a stylesheet a few directories up but that did not work.

    How do I set the stylesheet_url to a different value?

    moshu

    (@moshu)

    stylesheet_url will work only inside one (1) installation.
    When HS said absolute path, he meant (I assume)
    h t t p: // example.com/whatever/style.css

    Edit. And replace the template tag with the absolute path.

    Chris_K

    (@handysolo)

    correct, that’s what I meant.

    Doodlebee

    (@doodlebee)

    I don’t know if this would help…(I’m not sure I understand the original question) but, just in case…

    I have 4 stylesheets I need to use in my one blog page. It took some searching, but I discovered that if I changed this:

    <?php bloginfo(‘stylesheet_url’); ?>

    to this:

    <?php bloginfo(‘template_directory’); ?>/css/forms.css”

    I could have my stylesheets in one directory, and have the URL path show up to a point – and I could define the rest of it after. The original would always plug in the full path to my default stylesheet, down to “styles.css” – but the above code – placed in the “href” area, would allow me to just define up to my CSS *folder* and then I could just tack on “/stylesheet name here.css”. Now all four of my stylesheets appear just fine. 🙂

    deko

    (@deko)

    I think I figured it out.

    Here’s the file I changed:

    wordpress/wp-includes/functions.php #line 1684

    Here’s the change:

    function get_stylesheet_uri() {
    /*
    $stylesheet_dir_uri = get_stylesheet_directory_uri();
    $stylesheet_uri = $stylesheet_dir_uri . "/style.css";
    return apply_filters('stylesheet_uri', $stylesheet_uri, $stylesheet_dir_uri);
    */
    return apply_filters('stylesheet_uri', "/style-wp.css", "/");
    }

    Now I can have as many blogs (separate installations) as I want (same theme) and just one stylesheet for all of them.

    Still testing, but so far it seems to work.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to use one stylesheet for several blogs?’ is closed to new replies.