Calling a Sidebar Created by WooSidebars within Timber

I’ve used WooSidebars in a lot of projects to allow for custom sidebars much like using ACF. This is the first time however I’ve decided to also use it within the Timber Framework. I have the sidebar registered within my functions.php and the sidebar itself works. Now if I create a sidebar from with WooSidebars and try to aside widgets to it, it seems that the overrides that WooSidebars is doing doesn’t get picked up by Timber.

I’m calling:

Read More
$context['sidebar'] = Timber::get_widgets('page');

And within the plugin I’m creating a widget area to replace page on a contact us page with a different sidebar. Timber will only continue to pick up the page sidebar rather than the override. However if I call

$context['sidebar'] = Timber::get_widgets('contact-us-sidebar');

manually it’ll work.

Is there a way to inform the Timber context that I need the WooSidebar supplied sidebar instead of the default, literal sidebar?

Related posts

1 comment

  1. Over the years I’ve been able to solve this in two ways, though neither feels all that ideal for me, it’s been getting the job done.

    1. Don’t use widgets to manage the sidebar content and instead manage it on-page within a custom field.
    2. If you do want/need to use widgets I then create a dropdown custom field which has all the widgets in it, using their ID as the value. Then I grab this value and pass it into Timber::get_widgets to get the sidebar on I want for the page.

Comments are closed.