Adding class to #container

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #4237 Reply
    Tony T
    Guest

    After much trial & error I’ve found I need to set min-width for #container to different values for pages with left sidebar and pages with no sidebar in order to get horizontal scrolling to work as I want. Could you give me an edit which would add a class to #container please which would let me distinguish between the two in the stylesheet (something like the class=”<?php echo frontier_option…… used for #main perhaps)? I’m using a frontier-child theme. Thanks for any help!

    #4238
    Ron
    Keymaster

    The <body> tag outputs classes that are unique per page and per page-template used. You can use it like this:

    body.page-template-page-c-php #container {}
    body.page-template-page-sc-php #container {}
    body.page-template-page-cs-php #container {}
    body.page-template-page-scs-php #container {}

    c = content
    s = sidebar

    Though I’m quite unclear on what you are actually trying to do. Maybe there’s a better way.

    #4242
    Tony T
    Guest

    Thanks Ron. I hadn’t spotted the different classes on the <body> tags. That will let me do what I think I need. I understand it looks confusing but I need the full-width page (just the one at the moment) to behave differently from the pages with a sidebar in the way they cope with different size screens and after exhaustive experimenting I’ve identified #container as the key. The original responsiveness.css works very well and only needs a little tweaking for my appplication so thanks for a nice build.

    I’ll leave a review once I’ve finished developing the site, but this is my first venture into WordPress and I feel lucky to have hit on Frontier as a theme more-or-less from the outset. More luck than skill! I’m comfortable with HTMl and css and know a moderate amount of Perl, but php is a new experience and I couldn’t work out how to add a class to #container. Your solution’s much better because I don’t have to edit a template file.

    Thanks again, and for a prompt reply!

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: Adding class to #container
Your information: