I am net to Timber and TWIG. I can't get the dynamic sidebar to show up. My goal is for the content to only show up if there is a dynamic sidebar and you are on the front-page.php. Currently it tells me that there is widget area, however I am not on the correct page. I am sure that front-page.php is getting rendered however. I am working with the Timber starter theme (Github) for Wordpress as a base. I can get the Widgets to show, if I add the code directly which I commented out in the front-page.twig
sidebar.php
#Timber::render( array( 'sidebar.twig' ), $data ); if i understand right, i can remove this?
$context = array();
$context['dynamic_sidebar'] = Timber::get_widgets('home_sidebar');
Timber::render('sidebar.twig', $context);
functions.php i added this to the end of the file:
function custom_widgets_init() {
register_sidebar( array(
'id' => 'home_sidebar',
'name' => __( 'Dynamic Sidebar 1', $text_domain ),
'description' => __( 'This sidebar is located on the left side of the content.', $text_domain ),
) );
}
add_action( 'widgets_init', 'custom_widgets_init' );
font-page.twig
{% extends "base.twig" %}
{# STUFF #}
{% block sidebar_area %}
<aside>
{{dynamic_sidebar}}
{# {% do function('dynamic_sidebar', 'dynamic-sidebar-1') %} THIS HOWEVER WORKS #}
</aside>
{% endblock %}
sidebar.twig : is currently empty