Support » Fixing WordPress » Sidebar not working right on single posts

  • Hi –

    If you check out my site…

    you’ll see that the sidebar displays properly until you click on a single post. When you do that, the formatting gets weird (the background color for the sidebar disappears, and you can’t see the links unless you highlight them.) The google ad bar and whatnot still shows up properly, but I can’t figure out why the formatting gets altered.

    Can anyone point me in the right direction?


Viewing 11 replies - 1 through 11 (of 11 total)
  • You didn’t mention you altered the original theme 🙂
    By design it was not supposed to display any sidebar on the single post view.

    Oh. hehe. I guess I didn’t even realize I had done that!

    Well, is there still a way I can get it to display properly? Seems like it’s almost there, there’s just something missing that’s causing the weird formatting.

    Probably there is, I just don’t know what is what you modified.
    You seemingly altered the single.php template file by adding the call for the sidebar, but it’s not that simple. The single.php uses different divs and page structure.

    I don’t think I modified anything other than adding the
    <?php get_sidebar(); ?>

    to the single.php

    I don’t think I modified anything other than adding the
    <?php get_sidebar(); ?>

    That’s the problem 🙂 You should!

    Fair enough .. Any guesses on where to start? I’m still learning WordPress, so I’m not that familiar with the coding yet. I’m just not sure what I would need to change

    Try this:
    Put aside (=re-name and save) the original single.php and try to save the index.php as single.php
    See if it works.
    It is not about “learning WordPress”. It is basic HTML.

    The index.php has this after the body tag:
    <div id="rap"> <!--div rap starts-->
    while the single.php starts like this:
    <div id="rapsing"> <!--div rap for single post page starts-->

    Thanks moshu. That worked perfectly!

    I appreciate the help

    Glad to hear that. (next time contact the theme author 😉

    Hello, Moshu & all!

    I’ve tried the above, as well as the other trick floating-around.. Adding <?php get_sidebar(); ?>
    just before <?php get_footer(); ?> (of course, after changing the content id to “narrowcolumn.”

    Both techniques work quite well!

    Only problem is that the newly aquired navbar in the single.php loses its background color…. Where it’s a light gray everywhere else (this is the default template), when it’s introduced to single.php, it’s a white background.

    Same is true with both techniques – It’s almost as though, somewhere, there’s a line of code that says, “Make it gray everywhere, unless the file is called single.php” <smile>

    Seriously – I’ve looked everywhere, and can’t figure out how to make it look as it does everywhere else now that I finally have the sidebar in sidebar.php

    Thank you in advance for your guidance!

    Aha – I couldn’t sleep, and without success on Google, I stumbled-upon the problem myself… Oddly, despite the fact I was joking about it (above) there literally is a line that “takes away” the gray beneath the sidebar on pages using single.php

    In header.php, around line 20, remove the test for single, which forces the use of a different background image (one that lacks the elusive gray).

    After modification, the line looks like this:

    <?php /* Checks to see whether it needs a sidebar or not */ if (! $withcomments ) { ?>

    …and life returns to normal.

    Hope this helps someone else along the way.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Sidebar not working right on single posts’ is closed to new replies.