[resolved] css help (5 posts)

  1. charismaarts
    Posted 3 years ago #

    Hello: I hope this is easy for someone to answer; I am trying to put sidebar on "posts" in 2011 theme. I am using a child theme. I got the "get sidebar" thing added to the "single.php" file and it is now showing on the post pages. The problem is that the sidebar is not displaying properly; it makes it so the post content drops below the sidebar; the post content is "centered" on the page which is part of; if not all of the problem...

    i found this css which is causing it to be centered:
    .singular {margin: 0 auto;}

    now using firebug when i remove the "auto" from that css statement it pushes the post content over to left which looks like it may fix the whole problem; if it doesnt I know it will at least help...

    but I do not know how to "undo" that css statement (from core wordpress) in my child themes css file; what would I do to "undo" the "auto" or the whole thing?

    Can anyone help?

    Thanks, Gerard

  2. Alexandru Vornicescu
    Posted 3 years ago #

    can you show a screenshot? or the site...

  3. charismaarts
    Posted 3 years ago #

    hmmm - I cannot see how to attach a pic; but i can just give you the url:


    Thanks, Gerard

  4. Michael
    Forum Moderator
    Posted 3 years ago #

    for adding a sidebar to single posts (and pages) in a child of Twenty Eleven, see my article.

    the 'get_sidebar' code needs to be added just before the 'get_footer' line; then you need to add the corresponding code to functions.php to remove the .singular body_class;

    add_filter('body_class', 'adjust_body_class', 20, 2);
    function adjust_body_class($wp_classes, $extra_classes) {
    if( is_single() ) :
          foreach($wp_classes as $key => $value) {
          if ($value == 'singular') unset($wp_classes[$key]);
    endif;   // Add the extra classes back untouched
    return array_merge($wp_classes, (array) $extra_classes);

    see also the related forum topic: http://wordpress.org/support/topic/sidebar-is-at-the-bottom-of-the-page-when-viewing-full-page-post?replies=3#post-3173795

  5. charismaarts
    Posted 3 years ago #

    thank you very much that worked great!

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.