Search code examples
wordpressthemeschildren

Wordpress Multisite Child Theme not working


I have a multisite version of Wordpress running. I want the main site to use the parent theme, and the other sites to use child themes (which basically have css color modifications). I setup a child theme, uploaded it and then activated it on one of the sites ... but the site is just showing the Parent theme. Here is what I have ...

The parent directory is "CMO" and the child directory is "CMO-P". I activated the themes via the network, so they are both visible in the dashboard under THEMES. I activated the CMO theme for the main site, and CMO-P for the other site.

Child theme style.css

/*
Theme Name: CMO Child P
Template: CMO
*/

@import url("../CMO/style.css");

/* #Colors
================================================== */
h1 { color: #77d100; } /* Headers */
h2 { color: #77d100; }
h3 { color: #77d100; }
h4 { color: #77d100; }
/* ... and other style changes */

When I look at the site's source code (the site with the child theme implemented), the style sheet that is being pulled is "/CMO/style.css" and not the "/CMO-P/style.css" ... [if I edit the source code, and change CMO to CMO-P, then the site looks fine]

Any idea what is going wrong? How do I get it to choose the correct stylesheet?


Solution

  • I figured it out... (only took 24 hours).

    The code above was correct. The header.php document was pointing to the PARENT style sheet location, and not the CHILD style sheet.

    In the parent theme (header.php), I was using ...

    <link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/style.css" />
    

    and should have been using

    <link rel="stylesheet" href="<?php echo get_stylesheet_directory_uri(); ?>/style.css" />