Archived topic
How to add widgets to sidebar element
5 replies · Started by Amiria on November 28, 2021
Hi there,
I have created a left-sidebar element that overrides the normal sidebar on some pages (example url below). I have so far managed to place a facebook widget into the sidebar element, which is successfully overriding the normal sidebar.
I would also like to add a widget to the sidebar element (the Social Warfare popular posts widget), but I am unsure how to add this to my sidebar element (it doesn't appear as an option in the list of blocks, and nor is there a shortcode option with this plugin). Is there an easy way to add this?
I was having trouble with custom sidebar plugins, so have attempted to set up sidebars using elements instead...however I am a novice, so not sure if this is wise!
Any help most appreciated. Thank you!
Hi Amiria,
Properly added/registered widget area should display on Appearance > Widgets on the list of widget area.
Can you share w/ us how you've created and added this "left-sidebar"? Perhaps you're using the theme's left-sidebar and placed a condition on it using a Layout Element? Let us know.
Thanks for your prompt response, Elvin.
I think I haven't done this properly, then, as it is not appearing under Appearance > Widgets.
I went to Appearance > Elements, and then created a new element, which I set as Block - Left Sidebar type. Then I set the location as the posts where I wanted it to appear. I then entered the code of the Facebook page widget directly into the editor of the new element/sidebar I had created. I titled the element 'New left sidebar'.
Thanks!
Hi Amiria,
If you are going to use widgets, it's better not using block element to completely override the sidebar.
As some of the widgets from 3rd party plugin won't show in the list of block element.
I would recommend using the default sidebar and adding widgets from Appearance > widget, set your block element to Hook> before_left_sidebar_content or after_left_sidebar_content, then use CSS to adjust the widget/block orders within the sidebar.
Let me know if there's anything unclear :)
Awesome, thank you! I have done this using hooks now. Thank you. :)
You are welcome :)