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:
$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?
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.
Timber::get_widgets
to get the sidebar on I want for the page.