Reputation: 119
I'm having a problem when it comes to adding sidebar at single.php. I already included
<?php get_sidebar(); ?>
But it seems to be appear below and the content(Blog post) still at the middle of the whole page. I've tried to check all of the previous forum but none of them helped me to figure this out.
Here's my single.php
<?php
/**
* The template for displaying all single posts.
*
* @package Tesseract
*/
get_header(); ?>
<div id="primary" class="full-width-page">
<main id="main" class="site-main" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', 'single' ); ?>
<?php tesseract_post_nav(); ?>
<?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;
?>
<?php comments_template(); ?>
<?php endwhile; // end of the loop. ?>
</main><!-- #main -->
</div><!-- #primary -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
Upvotes: 0
Views: 2471
Reputation: 149
The most logical reason for this to happen is that there isn't enough room for both the main content and the sidebar to appear next to each other. Check the width of your sections in your stylesheet and make the necessary changes to the styles.
Upvotes: 2
Reputation: 617
First of all you create the sidebar in the admin and then call that sidebar where you want.Following is the code for calling sidebar
<ul id="sidebar">
<?php dynamic_sidebar( 'right-sidebar' ); ?>
Use following link to know more about how to create a sidebar https://codex.wordpress.org/Function_Reference/register_sidebar
Upvotes: 1