Title: Adding Sidebar ID
Last modified: September 1, 2016

---

# Adding Sidebar ID

 *  Resolved [joand](https://wordpress.org/support/users/joand/)
 * (@joand)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/adding-sidebar-id/)
 * HI, I added the following to register a sidebar:
    /*Register Blog Page Sidebar*/
   add_filter( ‘pt-ocdi/import_files’, ‘ocdi_import_files’ ); function ocdi_before_widgets_import(
   $selected_import ) { $sidebars = array( ‘BlogPage’ => ‘Blog Page’, ); update_option(‘
   sbg_sidebars’, $sidebars ); } add_action( ‘pt-ocdi/before_widgets_import’, ‘ocdi_before_widgets_import’);
 * And it worked – the sidebar was added. However I wanted to import widgets into
   this sidebar but the import is looking for the widget ID:
    et_pb_widget_area_1:
   Sidebar does not exist in theme (moving widget to Inactive)
 * Is there a way I can add the widget ID to the code above?
 * [https://wordpress.org/plugins/one-click-demo-import/](https://wordpress.org/plugins/one-click-demo-import/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [Gregor Capuder](https://wordpress.org/support/users/capuderg/)
 * (@capuderg)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/adding-sidebar-id/#post-7589044)
 * 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](https://wordpress.org/support/users/joand/)
 * (@joand)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/adding-sidebar-id/#post-7589050)
 * 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?
 *  Plugin Author [Gregor Capuder](https://wordpress.org/support/users/capuderg/)
 * (@capuderg)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/adding-sidebar-id/#post-7589053)
 * 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](https://wordpress.org/support/users/joand/)
 * (@joand)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/adding-sidebar-id/#post-7589061)
 * 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’?
 *  Plugin Author [Gregor Capuder](https://wordpress.org/support/users/capuderg/)
 * (@capuderg)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/adding-sidebar-id/#post-7589110)
 * 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!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Adding Sidebar ID’ is closed to new replies.

 * ![](https://ps.w.org/one-click-demo-import/assets/icon-256x256.png?rev=2506685)
 * [One Click Demo Import](https://wordpress.org/plugins/one-click-demo-import/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/one-click-demo-import/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/one-click-demo-import/)
 * [Active Topics](https://wordpress.org/support/plugin/one-click-demo-import/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/one-click-demo-import/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/one-click-demo-import/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [Gregor Capuder](https://wordpress.org/support/users/capuderg/)
 * Last activity: [9 years, 9 months ago](https://wordpress.org/support/topic/adding-sidebar-id/#post-7589110)
 * Status: resolved