Adding new Sidebar in Left


#1

hello
i want to add new Left Sidebar… is it possible ? i greateed new one but it switched my old sidebar and put it in left… now i have 2 sidebars, but i deleted it now … i just want have add new side bar in left side…
Thanks


#2

Hello there,

> i want to add new Left Sidebar…. is it possible ?

I thought it’s possible. But, it isn’t an easy task. Firstly, you should register your sidebar inside a function which hooked into widgets_init action.

register_sidebar( array(
	'name'          => __( 'Left Sidebar', 'sydney' ),
	'id'            => 'sidebar-left',
	'description'   => '',
	'before_widget' => '<aside id="%1$s" class="widget %2$s">',
	'after_widget'  => '</aside>',
	'before_title'  => '<h3 class="widget-title">',
	'after_title'   => '</h3>',
) );

To display your new sidebar, put the following code in template files you wish it to be displayed on. I’d suggest you to read the WordPress template hierarchy for your reference.

<?php dynamic_sidebar( 'sidebar-left' ); ?>

To display it in the left side, you might need to put it right before the <div id=“primary” …. It would involve markup adjustment. If you have knowledge of HTML/CSS, it wouldn’t be hard.

As an information, editing the core theme’s files directly isn’t considered as a good approach. The modifications you have done will be overwritten once you are updating the theme in the future. Thus, you should pass it in a child theme mode. We have already had a ready to use Sydney child theme here.

I hope I’ve explained myself well.

Regards,
Kharis


#3

Hello Kharis
well i tried my best to understand u fully but looks like i fail abit instead of showing up on left side but it showed up in top of page as u can see here
i didt understand from ‘’ template hierarchy’'
i understand u when u explain in beginning with code,this easier way for me
what i did is
1- added code in function.php
function sydney_widgets_init() {
register_sidebar( array(
‘name’ => __( ‘Sidebar’, ‘sydney’ ),
‘id’ => ‘sidebar-1’,
‘description’ => ‘’,
‘before_widget’ => ‘<aside id="%1$s" class=“widget %2$s”>’,
‘after_widget’ => ‘</aside>’,
‘before_title’ => ‘<h3 class=“widget-title”>’,
‘after_title’ => ‘</h3>’,
) );
register_sidebar( array(
‘name’ => __( ‘Left Sidebar’, ‘sydney’ ),
‘id’ => ‘sidebar-left’,
‘description’ => ‘’,
‘before_widget’ => ‘<aside id="%1$s" class=“widget %2$s”>’,
‘after_widget’ => ‘</aside>’,
‘before_title’ => ‘<h3 class=“widget-title”>’,
‘after_title’ => ‘</h3>’,
) );

then i add code in Page.php which <?php dynamic_sidebar( ‘sidebar-left’ ); ?>

get_header(); ?>
<?php dynamic_sidebar( ‘sidebar-left’ ); ?>
<div id=“primary” class=“content-area col-md-9”>
<main id=“main” class=“post-wrap” role=“main”>

		&lt;?php while ( have_posts() ) : the_post(); ?&gt;

			&lt;?php get_template_part( 'content', 'page' ); ?&gt;

			&lt;?php
				// If comments are open or we have at least one comment, load up the comment template
				if ( comments_open() || get_comments_number() ) :
					comments_template();
				endif;
			?&gt;

		&lt;?php endwhile; // end of the loop. ?&gt;

	&lt;/main&gt;&lt;!-- #main --&gt;
&lt;/div&gt;&lt;!-- #primary --&gt;

<?php get_sidebar(); ?>
<?php get_footer(); ?>


thats all i did added 2 codes in function.php and in Page,php

Thanks for ur reply


#4

Maybe its easier for us if you have time send me Php files and i just exchange them by FileZilla

akramalidabaj@gmail.com

Thanks