WordPress.org

Ready to get started?Download WordPress

Forums

Sidebar not working right on single posts (12 posts)

  1. wehatewii
    Member
    Posted 8 years ago #

    Hi -

    If you check out my site...

    http://www.wehatewii.com

    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?

    Thanks!

  2. moshu
    Member
    Posted 8 years ago #

    You didn't mention you altered the original theme :)
    By design it was not supposed to display any sidebar on the single post view.

  3. wehatewii
    Member
    Posted 8 years ago #

    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.

  4. moshu
    Member
    Posted 8 years ago #

    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.

  5. wehatewii
    Member
    Posted 8 years ago #

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

    to the single.php

  6. moshu
    Member
    Posted 8 years ago #

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

    That's the problem :) You should!

  7. wehatewii
    Member
    Posted 8 years ago #

    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

  8. moshu
    Member
    Posted 8 years ago #

    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-->

  9. wehatewii
    Member
    Posted 8 years ago #

    Thanks moshu. That worked perfectly!

    I appreciate the help

  10. moshu
    Member
    Posted 8 years ago #

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

  11. bytetraveler
    Member
    Posted 8 years ago #

    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!

  12. bytetraveler
    Member
    Posted 8 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags