Support » Themes and Templates » Added second sidebar, need help with tweaking CSS/style sheet

  • Hi there- first off I have searched and read a lot of the posts about second sidebars in here, I swear! :). I have a theme that I have customized and do NOT want to switch to a 3 column and I needed to add a second sidebar.

    I was able to add the sidebar after reading an external blog post that I see many refer to in those threads. However I just can not get the stylesheet to work to make my new sidebar look like the original one- it is taking the CSS from the main page not the sidebar. I tried to copy the #sidebar code and paste it into the stylesheet with the new name (leftsidebar) but it doesn’t do anything. I tried several times, put it in different places but no luck. I’m at a bit of a loss. I have just basic CSS knowledge but I feel like I should be able to do this with what I know, but it’s not working. It is also pushing my content to the bottom but I’m sure I could figure that out with margins and padding eventually, the main issue is definitely the styling. Any help would be greatly appreciated! I am doing the coding on a dummy blog and then once I figure it out I’ll transfer it to the domain I want it on.

    I’m in the adult entertainment industry so please don’t be put off by the URL of the dummy blog. But if anyone is willing to take a look I’d really appreciate it: http://www.teenshumiliatingsissies.com

    Thank you in advance!! 🙂

Viewing 15 replies - 1 through 15 (of 26 total)
  • esmi

    (@esmi)

    Forum Moderator

    You need to place the new sidebar code inside it’s own unique id (eg <div id="sidebar2">) and not within a a div with the id of content.

    Now we’re getting somewhere!! Thanks so much, now I just need to work on positioning which I can probably figure out with the help of Firebug- if not I’ll be back 😉 Thanks again!!!

    Ok I got it all aligned correctly on the home page (where the blog is) but the other pages are all a little off- I can adjust the margins in CSS to get them correct but then the homepage is off- I’m am definitely confused now, as if the one margin setting is controlling all pages how could they be in a different position on the blog vs. the rest of the pages? The left sidebar is actually correct on all pages, but the content and original (right side) sidebar are off. Any thoughts?

    Also something I did must have made the ‘category’ at the bottom of a post disappear on my pages, but it is still there for the blog posts. No idea how that happened….

    Thanks in advance!!

    esmi

    (@esmi)

    Forum Moderator

    Start by sorting out the markup errors on your home page. Then move onto the CSS errors.
    http://codex.wordpress.org/Validating_a_Website

    Thank you. I was able to fix all the CSS errors. The markup errors were in the original theme, that worked fine before I added the sidebar. I’m thinking that although it may not be perfect code it should still work the same. I did not code this theme, I merely customized colors and such. I looked at the errors but have not used this tool before so am unable to fix a few of them, I’m hoping that they are fine.

    Unfortunately none of the CSS errors I fixed actually changed anything. Have you seen a theme do this before, where the margins are different on different pages but being controlled by the same code? It was fine before I added the sidebar…

    esmi

    (@esmi)

    Forum Moderator

    Have you seen a theme do this before, where the margins are different on different pages but being controlled by the same code?

    Yes and in virtually every case I’ve seen, it was a markup or CSS validation issue.

    Thanks so much for your help. I cleared up most of the markup errors- there are 3 left. One of which when I do what it says removes my footer, so I’m leaving that as is. The other two refer to code that for the life of me I can NOT find. It refers to <div id="post" 89"> but I can NOT find an ’89’ anywhere in any of my theme files. Is there perhaps more code that I don’t have access to?

    I really don’t know why that would affect what I’m doing now though as like I said the theme worked fine before I added the sidebar… and I didn’t add the ’89’ code so it must have already been there. I’m at a loss…again. Sorry if I’m being a pain 🙁 I’m so close to getting it right but have completely hit a wall here.


    esmi

    (@esmi)

    Forum Moderator

    I can see to sidebars in roughly the right place now, so it looks like you’re on the right track.

    Thanks. The problem now is that they are correct on the main page but the positioning is off on the other pages- the positioning seems to all be controlled by the same margin codes in the CSS and when I adjust one, the others go out of position, or vice versa. I just do not understand how they are off on one but fine on another. I have decent CSS skills but there is obviously something I am missing here… thoughts?

    Thanks again for all your help, it is greatly appreciated!!

    esmi

    (@esmi)

    Forum Moderator

    Try adding the body_class() to the <body> element in header.php. That way you’ll be able to style on a page-per-page basis.

    Thank you I’m sure that will be exactly what I need. Unfortunately it is also a bit beyond my CSS skill level. I added that in header.php but now am unsure how to add the page classes into the stylesheet. I read the article you linked but I dont know where to add what they say in the implementation part, or how to assign each page. My abilities in CSS draw the line at tweaking with Firebug’s help, and the ability to read what is already there- I could never do this from scratch though so adding things is a bit confusing to me.

    Am I asking for too much help here? I’m not sure how much is provided here and I don’t want to take advantage of your time and help if I’m asking above and beyond what this forum is for…

    esmi

    (@esmi)

    Forum Moderator

    Use Firebug to see what classes are being generated on each page and then use the most appropriate class to focus your CSS on just that page if necessary.

    Ok I see the page ID’s in Firebug, for example <body class="page page-id-37 logged-in"> and from the article you linked it says I need to add to my stylesheet `.page {
    /* styles for all posts within the page class */
    }
    .page-id-2 {
    /* styles for only page ID number 2 */
    }
    .logged-in {
    /* styles for all pageviews when the user is logged in */
    `where in the stylesheet do I add this? Under the specific thing I’m looking to customize, such as the sidebar, content, etc? Do I need to add this in each section and for each page?

    esmi

    (@esmi)

    Forum Moderator

    You would use something like:

    .page .sidebar { [...]

    to style the sidebar on all Pages.

    .page-id-2 .sidebar { [...]

    to style the sidebar the Page with the ID of 2 only etc.

    Ok where do I put that? Do I start a ‘page’ section and put each page under it, or do I need to put it in the section of the element I’m controlling? (Sidebar, Content, etc) I tried it in a few different places and it moves everything all over the place…

    Also once I start assigning the styles to each page do I still leave the code that is already in the stylesheet under each element, or is that now irrelavant?

Viewing 15 replies - 1 through 15 (of 26 total)
  • The topic ‘Added second sidebar, need help with tweaking CSS/style sheet’ is closed to new replies.