It is great to try out new themes, widgets and layouts in WordPress and refresh its look, but it can mess with your widgets. Use a simple plugin to save widgets and reload them anytime.
There are many thousands of themes for WordPress websites and there are a lot of free ones. If you want to give your blog or website a fresh look, something more professional and less home made perhaps, a new theme can do the job. What’s more, you don’t have to be a developer or a geek to install one, just go to Appearance > Themes > Add new and choose one.
The main difficulty you will encounter is that widgets can get messed up. They are used in the sidebar of pages and posts, the footer, and may be used to build the home page too.
Some widgets are part of a theme and when switching themes, they are removed. If you decide you don’t want the new theme for whatever reason and switch back, will all the original widgets be restored? Maybe, but maybe not and you might need to recreate your home page, footer and sidebar all over again, which is a tedious task.
In the past I have even resorted to writing down lists of widgets before trying a new theme, in case I have to go back. Sometimes it is OK when switching, but I wouldn’t count on it.
It may be that you want to experiment with different widgets and perhaps try some different sidebar layouts, make changes to the footer or the home page, and so on. You might be able to come up with a better design and layout, but if you don’t, it can be a lot of work undoing the changes and putting everything back as it was.
Widget Importer & Exporter is a free plugin that enables you to save the current widget layout, basically everything on the Appearance > Widgets page. It also lets you import those widgets again, putting everything back as it was.
Here is the Widgets page in WordPress showing just some of the widget areas – Sidebar, Side Header Banner, Advertise Area, TimesNews Template Main Section. There are more areas and you can see that some have special widgets provided by the theme.
Switch themes and many of these widget areas disappear. Change things and you can forget how everything was originally set.
Install the plugin
Go to Plugins in the sidebar and then click Add New at the top. Enter ‘widget importer’ into the search box and Widget Importer & Exporter is listed. Click the Install Now button and then click Activate afterwards.
How to find the plugin
Go to the Tools menu in the WordPress sidebar and either click Tools and then Widget Importer & Exporter or let the mouse hover over it and then click it in the flyout menu.
Save WordPress widgets
There are import and export buttons and first you need to save the current widgets. Click the Export Widget button and after a couple of seconds you are prompted to save a file to disk.
Edit, delete widgets, switch themes
To test the plugin, I deleted all the widgets in each of the sections, switched themes, changed the theme, created new widgets, switched back and deleted everything again. A blank slate.
Restore WordPress widgets
To put all the widgets back as they were, return to Widget Importer & Exporter, make sure you have the same theme installed as when the widgets were saved, and click Choose File. You can then click Import Widgets.
That should be it and for many people it probably is, but I hit a snag and got an error message that the exported file could not be loaded. It could be something to do with the server. I was not using a real site (don’t mess around on a real live site), I was using WordPress on my computer – see Build WordPress sites on Mac or PC for testing before going live.
This is obviously a known problem not unique to me and there is a copy and paste link just under the Choose File button. Click the link and a text box is displayed. The widget file that is exported is plain text, so load it into a text editor like Notepad (PC) or BBEdit (Mac) and then copy and paste it into the box. Click the Import Widgets button and everything is restored.
This copy and paste method worked fine and is easy enough to do.
I wondered what it would do with HTML widgets with code in, and they were saved and reloaded with all the code intact. I didn’t try every possible type of widget and themes come with some special ones, but it worked for the ones I tried.
One thing to bear in mind is that if you change the order of widgets, such as in the sidebar, then import a saved set of widgets, the order is unchanged. If a widget is already present, it is not imported. The solution to this is to delete all the widgets and then the import restores them in the right order.