Change theme on all sub sites in multisite

I have a multisite & using new blog templates to create sub sites and they ALL use the same theme.
Now I want to upload and use a new, different theme.
What would be the easiest way to do that?
I read some other posts but they were older which said to delete all themes and just leave the new one that you want to use and your sites will automatically use that theme since its the only theme available.
However, since a child theme must be use there will be 2 theme folders, is that still a good idea? Will it default to the main theme & not the child or does it depend on the name, sorts alphabetically & chooses the first?

Currently I use a theme with a child, if I just put my new child theme in the same folder OR delete my current theme, install new theme and use the same exact name on the stylesheet, would that work without activating the new theme in each site?

Does it reset menus and other things when changing themes?

Any tips on how to change the theme on all sub sites at once?

thanks!!!

  • Nastia

    Hello @George, I trust you are well!

    Thank you for this question!

    Currently I use a theme with a child, if I just put my new child theme in the same folder OR delete my current theme, install new theme and use the same exact name on the stylesheet, would that work without activating the new theme in each site?

    The CSS from your Child theme may not work on another theme. The CSS classes may be different. You may test it on different WP installation, to see if the CSS from previous child theme will work.

    A better solution is to create a new Child theme on your test site and make changes there.

    Does it reset menus and other things when changing themes?

    Changing themes will not reset the menus. But you may need to assign again a primary manu. It depends from a theme.

    In order to set one default theme on all sites, put this code, in your wp-config.php file. You could add it anywhere, but before wp-settings.php file is included:

    define( 'WP_DEFAULT_THEME', 'your-theme-name' );

    Replace "your-theme-name" with a name of your theme. You can put the name of your Child theme as well.

    I hope this helps! Please, let us know if you require additional information!

    Cheers,
    Nastia

  • George

    Well I would add a new parent AND child, I am NOT trying to use another child with my current parent theme.
    The css in the top of child themes style.css always names the parent such as "Template: twentyfourteen", so figured if I just changed that to my new parent theme & kept the child theme name the same it may work? Will just have to try it :slight_smile:

    The solution you provided is much easier. That will define the default template but I could still go and change a theme on a individual sub-site as usual by editing the site in network admin, correct?

    Thanks so much for that!!

  • Sajid

    Hi @George

    Hope you are doing good today :slight_smile:

    I wrote a quick mu-plugin to do that automatically on existing sites. Just download the plugin from this gist.
    https://gist.github.com/sjaved87/75ee7167a162475fa7b3

    This mu-plugin will switch theme on all subsites (except main site) at once. Just change the theme directory slug, save chagnes and move it to wp-content/mu-plugins folder (create if not exists). Be care full if you have hunderds of sites then its not the right approach but good for handsome, also run it only once, delete or move it after that.

    Hope that would help :slight_smile:

    Cheers, Sajid

  • George

    Thanks Sajid, that worked great!!!
    Every request I make gets answered, you guys are the best !!

    Another question related to this topic...
    I use New Blog Templates so all my new sites created also have any settings I made in my default theme, everything is good to go.

    If you use this plugin to change all my site to this new active theme it works but of course you just get the theme activated with only the default settings, you have select a menu & add your logo etc just like when ever you would first install the theme.

    I can export the theme settings from my main site and import to each existing sub site one by one but that is not practical and takes too much time.

    Since NBT is able to copy all my themes settings to the new sites that are created, I was wondering if it would also be possible to copy those theme settings to all my existing sites? Or is that hard to say since all themes are different?

    Or would it just require a more complicated plugin that I would have to hire a coder to create?

    Thanks!!!

  • Sajid

    Hi @George

    Hope you are doing good today :slight_smile:

    You are welcome we always try our level best to solve issues of our members.

    I would love to do that but as you mentioned above its more than a quick mu-plugin, that is beyond the level of support we can provide in this forum.

    For this one, you need to hire a third party developer from job board.

    However if you know how (option key) and where its saving (mostly wp_options) the data in database then you can do this via phpMyadmin and import/export from there. Even run a SQL query if you are comfortable with it.

    Take care and keep loving WPMUDEV :slight_smile:

    Cheers, Sajid

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.