Support » Fixing WordPress » Trouble displaying sidebar advertisement on every page

  • evsecrets


    Hi folks,

    After searching first, I couldn’t find any other posts here about this seemingly simple problem.

    On my new site I have three advertisements which repeat on the right hand sidebar, linking to the product we’re offering.
    I placed those three sidebar adverts using the Appearance>Widgets>Text option in the menu. The point & drag widget thingy made life quite easy.

    However, when you click on an individual story, the page doesn’t show any sidebar advertising at all.

    Ideally, I’d like one of those long sidebar ads displayed on every page the reader goes to. I’ve tried pasting different things into different places in the Appearance>Editor>Sidebar.PHP page but the banner ad ends up in the most bizarre places; normally at the bottom of the page!

    I’m running the standard “Twenty eleven 1.2” theme which is nice and clean.

    Any help (in non geek-speak) would be greatly appreciated.


Viewing 5 replies - 1 through 5 (of 5 total)
  • Michael


    Forum Moderator

    the sidebar behavour is so by design in Twenty Eleven.

    please don’t edit the default theme Twenty Eleven directly – it is important to have an unedited default theme in case of serious problems.
    please create a child theme to make the edits there:

    when your child theme is in place, there is a solution available to have sidebars in single posts.



    Ok, we’re getting somewhere. Thanks very much for you help.

    I’ve created a Child Theme file in it’s own folder within my website, and filled in all the details as per the instruction page, however I’m not certain how to make the sidebar advertisement show up.

    If it helps, the sidebar advert (jpg file) is located here.

    According to another WordPress help page, I think the code is
    <?php include (‘sidebar2.php’); ?>
    However I’m not certain if this is correct, and more importantly, even if it is the right code to use, I have no idea where to insert this line into the child page.

    Is anyone able to tell me where to put this line (if it’s correct)?



    Forum Moderator

    activate the child theme;

    if you want the same sidebar to show in single posts as on the front page, edit single.php (copy single.php from Twenty Eleven into the child theme folder) and add the <?php get_sidebar(); ?> code before the ‘get_footer’ line.

    then edit functions.php of the child theme (if it does not yet exist, create an empty functions.php file in the child theme) and add this code:
    (if you have a new, empty functions.php, you need to add <?php first to the start – make sure there is no other character before that)

    add_filter('body_class', 'adjust_singular_body_class', 20, 2);
    function adjust_singular_body_class($wp_classes) {
    if( is_single() ) :
    // Filter the body classes
          foreach($wp_classes as $key => $value) {
          if ($value == 'singular') unset($wp_classes[$key]);
    return $wp_classes;


    Ok, will try that now. Thank you very much.



    Mr Alchymyth, I love you, and I think I want your babies.

    (It works, thank you very very very much)

    Three nights of toil have been solved in 2 minutes thanks to your help. There’s a bucketload of good karma heading your way I’m certain. 🙂


Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Trouble displaying sidebar advertisement on every page’ is closed to new replies.