Hi,
you would have to create a “widgets import file” (export widgets), with this sidebar registered and populated with widgets that you want.
Or you could edit the widget.json file to change the widget id to the one you want, but you have to be careful not to “break” the json file.
Take care!
Thread Starter
joand
(@joand)
I had used the Widget Importer & Exporter plugin to create the widget file – it does have that sidebar (et_pb_widget_area_1) with the widgets populated in it – but how do I register the sidebar?
Hi,
the sidebar is not already registered in the theme that you are importing to?
A sidebar should be registered inside a theme or you could use a plugin for custom sidebars and use it’s filters to register a sidebar.
You can’t register a sidebar directly in our plugin (in our action hooks), that will not work…
Take care!
Thread Starter
joand
(@joand)
No, I am trying to create an install package for a child theme, and it is a new sidebar that I have registered. This is for the Divi theme which has the option build into it to register new sidebars by adding them in the WordPress Widget area.
Your plugin did work to create the new sidebar! See the code I added in the first post – the sidebar is there when I go into the site after importing the data. I am just missing the way to match them up. (I only vaguely understand this, and I don’t know enough php to be able to figure out how to code it) It is looking for sidebar et_pb_widget_area_1 – is there not some way I can add that to the original code? Instead of BlogPage can I call it like:
‘et_pb_widget_area_1’ => ‘Blog Page’?
Hi,
I don’t have experience with divi theme, so I don’t know how to create new sidebars via code. If it’s just an options update (like in your code above), then you just need to set the correct id for the newly created sidebar (et_pb_widget_area_1 in your case) and it will import the widget to the correct sidebar.
I would recommend that you contact the divi support and ask them how to register a custom sidebar via PHP code with a predefined id.
Take care!