Positioning a sidebar on the side
-
I have set up a custom template for one of my site pages. On this page, I want to have a sidebar. Right now I am using a child theme of twenty-twenty. I tried to copy the tags from twenty seventeen on my sidebar file but it displays the sidebar at the bottom of the page. I need help displaying the sidebar on the right-hand side of the page.
This is the code of my sidebar php file.
<div id="sidebar-kgm-filters" class="sidebar"> <aside id="secondary" class="sidebar" role="complementary"> <?php dynamic_sidebar( 'kgm-filters' ); ?> </aside> </div>
This is the code of my template php file.
<?php /** * Template Name: Courses Template * Template Post Type: post, page * * @package WordPress * @subpackage Twenty_Twenty * @since Twenty Twenty 1.0 */ get_header(); ?> <main id="site-content" role="main"> <?php $archive_title = ''; $archive_subtitle = ''; if ( is_search() ) { global $wp_query; } if ( have_posts() ) { $i = 0; while ( have_posts() ) { $i++; if ( $i > 1 ) { echo '<hr class="post-separator styled-separator is-style-wide section-inner" aria-hidden="true" />'; } the_post(); get_template_part( 'template-parts/content', get_post_type() ); } } elseif ( is_search() ) { ?> <div class="no-search-results-form section-inner thin"> <?php get_search_form( array( 'label' => __( 'search again', 'twentytwenty' ), ) ); ?> </div><!-- .no-search-results --> <?php } ?> <?php get_template_part( 'template-parts/pagination' ); ?> <?php get_sidebar( 'kgm-filters' ); ?> </main><!-- #site-content --> <?php get_template_part( 'template-parts/footer-menus-widgets' ); ?> <?php get_footer();
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Positioning a sidebar on the side’ is closed to new replies.