Display both left and right sidebar?
-
Hi, Anthony! Great work on the Quark theme.
I’m trying to figure out how to display the default right sidebar on all pages along with an additional left sidebar. After piecing together instructions from various tutorials, I managed to get a new sidebar to show up on the left, but now the right sidebar is being pushed all the way to the bottom of the page, beneath all my post content, instead of showing up on the right like I want it to.
These are the code snippets I’ve added:
functions.php:
register_sidebar(array( 'name' => esc_html__( 'Left Sidebar', 'quark' ), 'id' => 'sidebar-left', 'description' => esc_html__( 'Left sidebar added by Ruji' ), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>' ));
index.php (including lines before and after the part I inserted so you can see where it is):
<div id="primary" class="site-content row" role="main"> <div id="sidebar-left"> <ul> <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('sidebar-left') ) : endif; ?> </ul> <div style="clear:both"></div> </div> <div class="col grid_8_of_12">
sidebar-left.php (new file I created according to instructions I found somewhere):
<aside id="sidebar"> <ul> <?php dynamic_sidebar( 'sidebar-left' ); ?> </ul> </aside>
style.css:
#sidebar-left { float: left; width: 20%; }
Please let me know how to make both sidebars display properly. Thanks!
- The topic ‘Display both left and right sidebar?’ is closed to new replies.