To make myself clearer, I created a menu with WP and I want to use it in one or more pages, on the left sidebar.
I created a custom sidebar in my child-theme, adding this code to functions.php:
if ( function_exists('register_sidebar') ) {
register_sidebar(array(
'name' => 'Paesi Sidebar',
'id' => 'paesi-sidebar',
'description' => 'Paesi',
'before_widget' => '<aside id="%1$s" class="widget %2$s">' ,
'after_widget' => '</aside>' ,
'before_title' => '<h3 class="widget-title">' ,
'after_title' => '</h3>' ,
));
}
Then I created a new template paesi.php with this code in it:
<?php
/*
Template Name: Paesi
*/
get_header();
do_action( '__fp_block' );
do_action( '__breadcrumb' );
?>
<div class="container" role="main">
<div class="row">
<?php
do_action( '__sidebar' , 'paesi-sidebar' );
do_action( '__loop' );
do_action( '__sidebar' , 'right' );
?>
</div><!--#row -->
</div><!-- #container -->
<?php
get_footer();
?>
and a sidebar-paesi.php file with this code:
<?php
/**
* The sidebar containing the left widget area for Paesi template.
*
*/
?>
<?php if ( is_active_sidebar( 'paesi-sidebar' ) ) : ?>
<div id="left" class="widget-area" role="complementary">
<?php do_action( 'tc_top_left_sidebar' ); ?>
<aside class="social-block widget widget_social">
<?php do_action( '__social' , 'tc_social_in_left-sidebar' ); ?>
</aside>
<?php dynamic_sidebar( 'paesi-sidebar' ); ?>
<?php do_action( 'tc_bottom_left_sidebar' ); ?>
</div><!-- #secondary -->
<?php endif; ?>
The sidebar is there in the Widgets page, and I added the custom menu to it: I thought all this would suffice, but the sidebar doesn’t show up at all…