I have a large multisite setup and want to use the BB theme there.
I always install new products/plugins on a clone of the site first instead of making changes to a live site in use.
Otherwise I would have to activate the theme and then recreate my current look & setup in BB. While doing that I would have put my live site in maintenance mode while creating my them in BB or is there a better solution?
If I clone my site, then get the BB theme setup there to look as I need it, is there a way to copy the theme over along with my new settings from the clone site to my live site? If I just copy the theme & child them over, will it also contain my changes made to the theme & settings or are those in database tables I could copy over?
Guess I should just try & see but figured I would see if there are any tips first or if even possible.
Also, all my pages were created with shortcodes from my current theme. So I will have to recreate all my pages using BB plugin. I guess the best way to do that is make my changes on a clone of the site and then export those pages, delete the pages in my live site and import my updated pages from the cloned site. Sound about right? Also how would I copy any page templates that I create with the BB plugin from one site to another?
Any tips on how to convert an existing site to BB theme & pages to use the BB plugin with minimal downtime?
You can export/import theme settings under Appearance > Customize > Export/Import. That should solve your theme issue.
Correct for the pages, you can create them in a clone site, export the pages, and import them to the live site. But you’ll need to run a Serialized Search and Replace to replace links/contents from the clone site. You can also use the plugin Better Search Replace. Or you can also change the links manually.
The same is true for the templates. Those are CPTs so you can import them as well.
I have another question on this topic for use in multisite that hopefully you can help me with
I have one main site used as a template that others are created from.
I installed BB theme and customized a few things, added a logo to the header & selected my header menu.
Now all my new sites created have the bb theme along with those same settings nothing needs to be done.
So I wanted to convert all my existing sites to use the bb theme so I created a plugin to switch the active theme on all existing sites to my new bb theme. So now all sites are using the bb theme but only have the default settings and need to be updated manually.
I know you said I could export the theme settings from one site and import to all my existing sites but that would be a lot of work since there are many sites. It would be helpful if I could mass import my settings to all my sites at once. Any ideas on how that could be done?
Unfortunately, I don’t think what you are looking for is possible, sorry about that. That would be pretty awesome, but I just don’t see how you could do that if that makes sense.
Thanks for the response Billy!
Would you be able to to find out where the theme settings are stored?
I assume somewhere in the options table? I will look myself, hopefully its obvious and easy to find.
If I could find out where they are stored I could probably write sql query that could copy that data to all my other sites.
Looks like it could be theme_mods_bb-theme-child for the the settings?
You are correct that the settings are stored as options under theme_mods_bb-theme-child OR theme_mods_bb-theme. You can actually grab those using the get_theme_mods WP function.
I haven’t tested this, but here’s an example of how you can update those on a number of different sites using PHP…
// An array of IDs for each site that needs to be updated.
$sites_to_update = array( 2, 3, 4, 5 );
// Enter the ID of the site who has the settings you want to copy.
switch_to_blog( 1 );
// Get the customizer settings for the main site.
$main_settings = get_theme_mods();
// Restore global variables to the current site.
restore_current_blog();
// Loop through the sites_to_update array.
foreach ( $sites_to_update as $site_id ) {
// Switch to a site to update.
switch_to_blog( $site_id );
// Loop through the settings and save them.
foreach ( $main_settings as $key => $val ) {
set_theme_mod( $key, $val );
}
// Restore global variables to the current site.
restore_current_blog();
}
I hope you don’t mind me joining in on this conversation.
What I do on Multisite sounds very similar to your case scenario. I have a Main multisite for creating sub sites that are semi configured for each type of site (plugins, themes, pages, page layouts etc)
The idea is to spend some time to create a site or set of sites that will be your starting point for your sub sites and turn these into master sites for templates. When you create a new sub site, you then simply select one of your master templates that have been closely built to the requirement. This saves you hours when building many sites.
I hope I have presumed correctly on what part of your question was.
Ah didn’t know there have been reply’s and I wasn’t paying attention after Billy mentioned this wouldn’t be possible
@Peter, yes please offer any advice you have and I do also use the New Blog Templates from wpmudev and it copies a BB site & all settings when a new site is created. However, what I was trying to do is switch to the BB theme on an existing multisite install that already has 100’s of sub sites. I can activate the theme across the network but then all sites just have the default theme settings and NOT the settings I created in my default site that is copied to all new sites. Know what I mean?
It was easy to find the theme settings though in the options table, I should have looked first
@Justin, thanks for the code! I was able to create a plugin and from the admin backend where I can choose my default (or any other site) and copy my BB theme settings to any or all other sub sites.
So now I can roll out the theme to all my sub sites at once.