Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

As the title says, I have a multi-site setup and the apperance is customized with child themes.

The main site: themainsite.com

Secondary site foo.com

When you look into the source code of foo.com, you see some URLs referencing to the mainsite. Such as:

<link rel="stylesheet" 
href="http://www.themainsite.com/wp-content/themes/sometheme/css/some.css" 
type="text/css" media="screen" />

I checked wordpress documentation for get_stylesheet_directory_uri, but could not find an answer. Is it possible to remove these kind of references to the main site?

UPDATE: All the CSS/JS references are handled in the header.php of the parent template like below. I already have a header.php oin my child theme which overrides the parent theme's header.php.

<link rel="stylesheet" 
href="<?php echo get_template_directory_uri()  ?>/css/some.css" 
type="text/css" media="screen" />
share|improve this question

2 Answers 2

up vote 0 down vote accepted

I fixed it with changing the multi-site setup from sub-folders to sub-domains.

share|improve this answer

Note: I'm going for an answer, because for a comment this is quite too much text. With your response, I will be trying to edit and elaborate, and provide you with an actual answer to your question.

Is it possible to remove these kind of references to the main site?

That depends on how (well) the themes are designed, where/why this some.css is enqueued/hard-coded, and how you want to remove the line.

Did you find where the stylesheet is handled? What is it used for? Do you want to adjust the parent theme, or the child theme only?

» The ungallant way

I would not prefer this, but assuming the stylesheet is hardcoded in the parent theme, which you don't want to adjust, you could delete the stylesheet (if it is really not needed, that is) by jQuery:

$('link[rel="stylesheet"][href^="http://www.themainsite.com/"]').remove();

// EDIT, regarding your edit :)

You already gave the answer yourself: use get_stylesheet_directory_uri instead of get_template_directory_uri. The latter points to the base theme (which is the parent theme), while you actually want to load stuff from the child theme (where your stylesheet style.css is located, hence the name).

share|improve this answer
    
Thanks t f. I updated the question to elaborate the case. Is there any native api to get the style sheet url of the secondary site? –  noway Apr 10 '13 at 8:36
    
Updated answer according to your edit. –  t f Apr 10 '13 at 8:40
    
:) Thanks. However it doesnt't help. get_stylesheet_directory_uri returns the URI of the child theme of the main site (themainsite.com), not the secondary site. (foo.com) –  noway Apr 10 '13 at 8:45
    
Okay, then please elaborate a little on your setup. You have two domains: themainsite.com and foo.com. Where are they pointing at? Different servers (or at least WordPress installs) which both have the parent and child theme installed? Or is it just one WordPress install, and the two websites share the same data, but appear differently according to their different themes? –  t f Apr 10 '13 at 8:56
    
Thanks for your helps. I fixed it with changing the multi-site setup from sub-folders to sub-domains. –  noway Apr 10 '13 at 10:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.