How to add a sidebar to single posts using the Twenty Eleven WordPress theme

I have been using the Twenty Eleven Theme for WordPress as a basic, no-frills design that gets my blog working with the minimum of fuss. Unfortunately, the Single Post (single.php) template in its unmodified form used a very basic design with just one column and no sidebar. This left a lot of unused and valuable real estate on the screen and most importantly meant that I couldn’t include skyscraper ads.

Instead of a single column design, I wanted something like this:

Instructions to add a sidebar to single posts and pages (2011 WP theme)

Open the theme editor (Appearance > Editor) and edit Single Post (single.php).

Find this code:

<?php get_footer(); ?>

And add this just above:

<?php get_sidebar(); ?>

Edit styles.css and paste the following text at the end of the stylesheet:

/*** add sidebar to single post ***/
.singular #primary {
margin: 0 -26.4% 0 0;
}

#nav-single {
display: none;
}

.singular .entry-header .entry-meta {
position: relative;
}

.singular .hentry {
padding: 0;
}

.singular .entry-header, .singular .entry-content, .singular footer.entry-meta, .singular #comments-title {
width: 100%;
}

.singular #content, .left-sidebar.singular #content {
margin: 0 34% 0 7.6%;
}

.singular article .entry-title {
padding-top: 0;
}

.singular .entry-meta .edit-link a {
right: 0;
top: 0;
left: auto;
}

Make sure you save the changes and then view a single post to check if it works.

About Brian

I have very nearly completed the PGCE ICT with Computing Course at King's College London. Before starting this programme, I taught English and ICT in Asia and also worked as a network administrator in the UK.
This entry was posted in Uncategorized and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>