I am developing a child theme for the new twenty thirteen theme and I am trying to add a sidebar (widget area) next to my content. I only want it to display in single posts.

What I did: edit single.php (and add it to my child theme's folder) like so:

get_header(); ?>

    <div id="primary" class="content-area">
        <div id="content" class="site-content" role="main">

            <?php /* The loop */ ?>
            <?php while ( have_posts() ) : the_post(); ?>

                <?php get_template_part( 'content', get_post_format() ); ?>

                <?php get_sidebar('sidebar-3'); ?> <!-- DOESN'T WORK -->
                <!-- /END of sidebar-aside-content -->
                <?php twentythirteen_post_nav(); ?>
                <?php comments_template(); ?>

            <?php endwhile; ?>

        </div><!-- #content -->
    </div><!-- #primary -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>

And registered the sidebar in functions.php, like so:

function mobiel_informatie_widgets_init() {
    register_sidebar( array(
        'name'          => __( 'Sidebar next to content', 'twentythirteen' ),
        'id'            => 'sidebar-3',
        'description'   => __( 'Wordt naast een single post weergegeven.', 'twentythirteen' ),
        'before_widget' => '<aside id="%1$s" class="widget %2$s">',
        'after_widget'  => '</aside>',
        'before_title'  => '<h3 class="widget-title">',
        'after_title'   => '</h3>',
    ) );
add_action( 'widgets_init', 'mobiel_informatie_widgets_init' );

The thing is that I can see this widget area in Appearance >> widgets, but no matter what I add, nothing ever show in the template. I am guessing I'm doing something wrong with the name reference, but the docs aren't really clear on that in my opinion.


Here are some images to illustrate my problem:

The code of my single.php

The code of my single.php

The widget in WP, works fine

The widget in WP, works fine

The output -- nothing is outputted. There should be something before the /END comment.

The output -- nothing is outputted

The only thing I can think of why this wouldn't work, is because of a conflict with the parent theme (twenty thirteen). It has twee sidebars, written in functions.php, like this:

 * Registers two widget areas.
 * @since Twenty Thirteen 1.0
 * @return void
function twentythirteen_widgets_init() {
    register_sidebar( array(
        'name'          => __( 'Main Widget Area', 'twentythirteen' ),
        'id'            => 'sidebar-1',
        'description'   => __( 'Appears in the footer section of the site.', 'twentythirteen' ),
        'before_widget' => '<aside id="%1$s" class="widget %2$s">',
        'after_widget'  => '</aside>',
        'before_title'  => '<h3 class="widget-title">',
        'after_title'   => '</h3>',
    ) );

    register_sidebar( array(
        'name'          => __( 'Secondary Widget Area', 'twentythirteen' ),
        'id'            => 'sidebar-2',
        'description'   => __( 'Appears on posts and pages in the sidebar.', 'twentythirteen' ),
        'before_widget' => '<aside id="%1$s" class="widget %2$s">',
        'after_widget'  => '</aside>',
        'before_title'  => '<h3 class="widget-title">',
        'after_title'   => '</h3>',
    ) );
add_action( 'widgets_init', 'twentythirteen_widgets_init' );

2 Answers 2


In additon to wordpresser answer, you can also call to get_sidebar('sidebar-aside-content'); only in the template files where you want the sidebar be displayed. For example, if you include

<?php get_sidebar('sidebar-aside-content'); ?> 

in "theme_folder/single.php" file, the sidebar will be displayed only in single posts.

For example. In functions.php:

//Register your sidebar
add_action( 'widgets_init', 'my_widgets_init' );
function my_widgets_init() {
    register_sidebar( array(
    'name' => __( 'The title of my sidebar', 'curioso' ),
    'id' => 'sidebar-mysidebar',
    'description' => 'An optional widget area for my sidebar',
    'before_widget' => '<div id="%1$s" class="widget %2$s">',
    'after_widget' => "</div>",
    'before_title' => '<h3>',
    'after_title' => '</h3>',
 ) );

Now you have to create a file named sidebar-mysidebar.php and put it in you theme folder. This file will load the widgets. For example:

 <?php if ( is_active_sidebar( 'sidebar-mysidebar' ) ) : ?>

   <div class="mysidebar">
    <?php dynamic_sidebar( 'sidebar-mysidebar' ); ?>

 <?php endif; ?>

Now in the file of your theme where you want 'mysidebar' be displayed:

<?php get_sidebar('mysidebar'); ?> 
  • Please consider my edit. It still doesn't work. Sep 2, 2013 at 11:54
  • I think you have missed the template part for the new registered sidebar. I've edited my answer.
    – cybmeta
    Sep 2, 2013 at 13:47
  • As you can see in my edit, in the first picture, I have added the line <?php get_sidebar('sidebar-3'); ?> . It's right there, in my template file single.php. Sep 2, 2013 at 13:51
  • Have you read again my answer? I've edited it with complete information.
    – cybmeta
    Sep 2, 2013 at 13:55
  • Thanks so much. I didn't know it had to have its own template file! Thanks again! Sep 2, 2013 at 14:12
<?php get_sidebar('Widget Area Next to Content'); ?> 

should be

<?php get_sidebar('sidebar-aside-content'); ?> 

to display only on single posts

<?php if(is_single) get_sidebar('sidebar-aside-content'); ?> 
  • 1
    is_single() is a function, and should be written as such
    – shea
    Sep 2, 2013 at 11:26
  • Please consider my edit. It still doesn't work. Sep 2, 2013 at 11:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.