0

I am trying to change name of theme folder. Steps i am following are...

  1. upload backup files
  2. rename theme folder name on server
  3. in xml database file (demo content file of theme), find '/old-folder-name/' and replace all with '/new-folder-name/' using text editor.

The problem is most of the widgets stop working / displaying.

Can anybody help me?

5
  • Did you rename the theme in the style.css file? Commented Mar 9, 2017 at 10:18
  • @NathanielFlick yes. renamed theme name in style.css but that did not work.
    – kpmrpar
    Commented Mar 9, 2017 at 15:02
  • Go back to Appearance/Themes and activate another theme then the one you want again. Does it now show? Commented Mar 9, 2017 at 15:10
  • @NathanielFlick tried that and that did not work. I don't understand what theme folder name has to do with widgets. All widgets disappear after changing folder name.
    – kpmrpar
    Commented Mar 9, 2017 at 15:12
  • The widgets shouldn't have anything to do with the theme/folder name, which is why you need to solve that problem first. Hard to see what's going on without being able to see your theme/file structure. Commented Mar 9, 2017 at 18:19

1 Answer 1

0

Some themes save the recent sidebar widgets settings amongst other theme settings in wp_options as theme_mods_mynewtheme (assuming mynewtheme is your new theme folder name).

If you lost some settings (including widget settings), you can copy/paste the option_value contents of theme_mods_myoldtheme into theme_mods_mynewtheme. That may help or at least restore some theme settings. However, that might not restore your sidebar settings (theme-specific case, not general).

enter image description here

In general, if you haven't re-activated your theme under Appearance > Themes, you can save your old sidebar_settings first and re-insert them in the database after you reactivated your new theme:

  1. SELECT * FROM wp_options where option_name = 'sidebars_widgets'
  2. Copy the entire contents of option_value
  3. Re-activate your theme under Appearance > Themes
  4. Refresh the query from step 1
  5. Paste what you copied from step 2 into option_value

Edit: In case you don't have database access, you can programatically (somehow ugly approach) use the functions get_option and update_option to do the above. You can use maybe_serialize to serialize what you get from get_option and pass using maybe_unserialize to update_option.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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