I'm trying to add two new sidebars on my WordPress website here, one on the left and the other on the right, the main content then will be in the middle. Making the layout a three column.
I am using a Ready! To be Theme with Ready! E-Commerce plugin, I have also made the child where I made most of the changes.
The problem is the sidebar is not appearing on the website itself. And when viewing the Widgets area under Appearance Menu the widget area I added does not appear even after registering it.
This is the code I inserted on the front-page.php:
<?php get_sidebar('left'); ?>
<?php get_sidebar('right'); ?>
I then proceeded to create two sidebar.php files namely
sidebar-left.php which has the following code
<?php
/**
* The Sidebar containing the main widget areas.
*
* @package Ready_ecommerce
* @since Ready_ecommerce 0.1
*/
?>
<div id="secondary" class="widget-area sidebar" role="complementary">
<?php do_action( 'before_sidebar' ); ?>
<?php if ( ! dynamic_sidebar( 'sidebar-6' ) ) : ?>
<aside id="search" class="widget widget_search">
<?php get_search_form(); ?>
</aside>
<aside id="archives" class="widget">
<h1 class="widget-title"><?php _e( 'Archives', 'ready_ecommerce' ); ?></h1>
<ul>
<?php wp_get_archives( array( 'type' => 'monthly' ) ); ?>
</ul>
</aside>
<aside id="meta" class="widget">
<h1 class="widget-title"><?php _e( 'Meta', 'ready_ecommerce' ); ?></h1>
<ul>
<?php wp_register(); ?>
<aside><?php wp_loginout(); ?></aside>
<?php wp_meta(); ?>
</ul>
</aside>
<?php endif; // end sidebar widget area ?>
</div><!-- #secondary .widget-area -->
<style type="text/css">
#content {
float: left;
}
</style>
sidebar-right.php with the code:
<?php
/**
* The Sidebar containing the main widget areas.
*
* @package Ready_ecommerce
* @since Ready_ecommerce 0.1
*/
?>
<div id="secondary-2" class="widget-area sidebar" role="complementary">
<?php do_action( 'before_sidebar' ); ?>
<?php if ( ! dynamic_sidebar( 'sidebar-5' ) ) : ?>
<aside id="search" class="widget widget_search">
<?php get_search_form(); ?>
</aside>
<aside id="archives" class="widget">
<h1 class="widget-title"><?php _e( 'Archives', 'ready_ecommerce' ); ?></h1>
<ul>
<?php wp_get_archives( array( 'type' => 'monthly' ) ); ?>
</ul>
</aside>
<aside id="meta" class="widget">
<h1 class="widget-title"><?php _e( 'Meta', 'ready_ecommerce' ); ?></h1>
<ul>
<?php wp_register(); ?>
<aside><?php wp_loginout(); ?></aside>
<?php wp_meta(); ?>
</ul>
</aside>
<?php endif; // end sidebar widget area ?>
</div><!-- #secondary .widget-area -->
<style type="text/css">
#content {
float: right;
width: 759px;
}
</style>
And last, added the following lines to functions.php
register_sidebar( array(
'name' => __( 'Content Pages Right', 'ready_ecommerce' ),
'id' => 'sidebar-5',
'description' => __( 'Right sidebar area for content pages only. Not availabe at products or catalogue pages', 'ready_ecommerce' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => "</aside>",
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
) );
register_sidebar( array(
'name' => __( 'Content Pages Left', 'ready_ecommerce' ),
'id' => 'sidebar-6',
'description' => __( 'Left sidebar area for content pages only. Not availabe at products or catalogue pages', 'ready_ecommerce' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => "</aside>",
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
) );