Title: Problem getting sidebar on &#8216;Single Post.php&#8217;
Last modified: August 19, 2016

---

# Problem getting sidebar on ‘Single Post.php’

 *  [abbelsap](https://wordpress.org/support/users/abbelsap/)
 * (@abbelsap)
 * [17 years, 6 months ago](https://wordpress.org/support/topic/problem-getting-sidebar-on-single-postphp/)
 * I’ve created a custom theme for my WordPress Blog, but i have a problem with 
   getting the sidebar on the ‘single.php’ page.
 * If i try to add ‘<?php get_sidebar(); ?>’ it’ll add the sidebar beneath the page.
   Here is the link to the page i’m reffering to: [ click ](http://abbelsap.byethost22.com/blog/?p=17)
   
   So could anyone help me sorting this out? Thanks in advance!
 * And here is the code for that specific page.
 *     ```
       <?php get_header(); ?>
   
       	<div id="content">
       		<div id="contentHeader">
       					<div id="siteDescription"><?php bloginfo('description'); ?>
       </div>
       		</div>
       	<div id="mainAlone">
         <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
   
       		<!--
       		<div class="navigation">
       			<div class="alignleft"><?php previous_post_link('&laquo; %link') ?></div>
       			<div class="alignright"><?php next_post_link('%link &raquo;') ?></div>
       		</div>
       		-->
   
       		<div class="post" id="post-<?php the_ID(); ?>">
       			<h2><a href="<?php echo get_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a></h2>
   
       			<div class="entry">
       				<?php the_content('<p class="serif">Read the rest of this entry &raquo;
       '); ?>
   
       				<?php link_pages('<strong>Pages:</strong> ', '
       ', 'number'); ?>
   
       			<!--	<p class="postmetadata alt">
       					<small>
       						This entry was posted	on <?php the_time('l, F jS, Y') ?> at <?php the_time() ?>
       						and is filed under <?php the_category(', ') ?>.
       						You can follow any responses to this entry through the <?php comments_rss_link('RSS 2.0'); ?> feed. -->
   
       						<?php if (('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
       							// Both Comments and Pings are open ?>
       							You can <a href="#respond">leave a response</a>, or <a href="<?php trackback_url(true); ?>" rel="trackback">trackback</a> from your own site.
   
       						<?php } elseif (!('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
       							// Only Pings are Open ?>
       							Responses are currently closed, but you can <a href="<?php trackback_url(true); ?> " rel="trackback">trackback</a> from your own site.
   
       						<?php } elseif (('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
       							// Comments are open, Pings are not ?>
       							You can skip to the end and leave a response. Pinging is currently not allowed.
   
       						<?php } elseif (!('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
       							// Neither Comments, nor Pings are open ?>
       							Both comments and pings are currently closed.
   
       						<?php } edit_post_link('Edit this entry.','',''); ?>
   
       					</small>
   
       		</div>
       		</div>
       	<?php comments_template(); ?>
   
       	<?php endwhile; else: ?>
   
       		Sorry, no posts matched your criteria.
   
       <?php endif; ?>
   
       	</div>
   
       <?php get_footer(); ?>
       ```
   

Viewing 6 replies - 1 through 6 (of 6 total)

 *  [krembo99](https://wordpress.org/support/users/krembo99/)
 * (@krembo99)
 * [17 years, 6 months ago](https://wordpress.org/support/topic/problem-getting-sidebar-on-single-postphp/#post-917113)
 * Fisrt oa all, in the code you pasted there is no sidebar reference .
    Second –
   It is probably a fixed width css problem, your sidebar just does not have enough
   space to be where it is supposed to be on the main page . And hird – when going
   to your link (and the nthe “about” page – the sidebar appears just fine 🙂
 *  Thread Starter [abbelsap](https://wordpress.org/support/users/abbelsap/)
 * (@abbelsap)
 * [17 years, 6 months ago](https://wordpress.org/support/topic/problem-getting-sidebar-on-single-postphp/#post-917125)
 * No because i deleted it, when i DO add it, it will state the problem on the OP.
 * > If i try to add ‘<?php get_sidebar(); ?>’ it’ll add the sidebar beneath the
   > page.
 * But okay, i’ve added the function to display the sidebar. If you’ll click my 
   link again you’ll see the problem.
 * And like i said, it DOES appear fine on every other page, but just not on the‘
   single.php’ page (you know the page for permalink, comments and stuff)
 *  [krembo99](https://wordpress.org/support/users/krembo99/)
 * (@krembo99)
 * [17 years, 6 months ago](https://wordpress.org/support/topic/problem-getting-sidebar-on-single-postphp/#post-917152)
 * well.. you are missing a div…
    the ‘<?php get_sidebar(); ?>’ should come in a
   div on it’s own . just open some other page (like archive.php) and see the DIV
   division there..
 *  Thread Starter [abbelsap](https://wordpress.org/support/users/abbelsap/)
 * (@abbelsap)
 * [17 years, 6 months ago](https://wordpress.org/support/topic/problem-getting-sidebar-on-single-postphp/#post-917156)
 *     ```
       <?php get_header(); ?>
   
       	<div id="content">
       		<div id="contentHeader">
       					<div id="siteDescription"><p><?php bloginfo('description'); ?></p></div>
       		</div>
       		<div id="main">
       			<?php if (have_posts()) : ?>
   
       			 <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
       	<?php /* If this is a category archive */ if (is_category()) { ?>
       			<h2 class="pagetitle">Archive for the '<?php echo single_cat_title(); ?>' Category</h2>
   
       	 	  <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
       			<h2 class="pagetitle">Archive for <?php the_time('F jS, Y'); ?></h2>
   
       		 <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
       			<h2 class="pagetitle">Archive for <?php the_time('F, Y'); ?></h2>
   
       			<?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
       			<h2 class="pagetitle">Archive for <?php the_time('Y'); ?></h2>
   
       		  <?php /* If this is a search */ } elseif (is_search()) { ?>
       			<h2 class="pagetitle">Search Results</h2>
   
       		  <?php /* If this is an author archive */ } elseif (is_author()) { ?>
       			<h2 class="pagetitle">Author Archive</h2>
   
       			<?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
       			<h2 class="pagetitle">Blog Archives</h2>
   
       			<?php } ?>
   
       		<div class="navigation">
       			<div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div>
       			<div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div>
       		</div>
   
       		<?php while (have_posts()) : the_post(); ?>
       		<div class="post">
       				<h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
       				<small><?php edit_post_link('Edit', '', ' | '); ?><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --> | <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></small>
   
       				<div class="entry">
       					<?php the_content() ?>
                                                <br />
       				</div>
   
       			</div>
   
       		<?php endwhile; ?>
   
       		<div class="navigation">
       			<div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div>
       			<div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div>
       		</div>
   
       	<?php else : ?>
   
       		<h2 class="center">Not Found</h2>
       		<?php include (TEMPLATEPATH . '/searchform.php'); ?>
   
       	<?php endif; ?>
   
       	</div>
   
       <?php get_sidebar(); ?>
   
       <?php get_footer(); ?>
       ```
   
 * That’s the code of archive.php, as you can see, i don’t have it in a DIV division.
   However it does display the sidebar fine on every other page as you can see, 
   but just not on the single.php page..
    It’s really frustrating because i can’t
   seem to solve it.
 *  [krembo99](https://wordpress.org/support/users/krembo99/)
 * (@krembo99)
 * [17 years, 6 months ago](https://wordpress.org/support/topic/problem-getting-sidebar-on-single-postphp/#post-917167)
 * Like i said in the first post, you do not have enough place declares,
    And like
   I said in the second , a div is missin declare. So just replace your mainAlone
   in the csss with this :
 *     ```
       #mainAlone {
       margin: 15px 15px;
       width: 430px;
       float: left;
       }
       ```
   
 * and your problem will probably be resolved
 *  [krembo99](https://wordpress.org/support/users/krembo99/)
 * (@krembo99)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/problem-getting-sidebar-on-single-postphp/#post-917192)
 * I see that DID resolve your problem, It would be nice to tick this thread as [
   RESOLVED] so people who help here will have one less red alarm ..
    (Not to mention
   a small “thank you” which most of us do not even expect anymore..)

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Problem getting sidebar on ‘Single Post.php’’ is closed to new replies.

## Tags

 * [sidebar](https://wordpress.org/support/topic-tag/sidebar/)

 * 6 replies
 * 2 participants
 * Last reply from: [krembo99](https://wordpress.org/support/users/krembo99/)
 * Last activity: [17 years, 5 months ago](https://wordpress.org/support/topic/problem-getting-sidebar-on-single-postphp/#post-917192)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
