WordPress.org

Support

Support » Themes and Templates » Style Sheet Coding

Style Sheet Coding

  • moeryan18

    @moeryan18

    Hi Everyone,

    I am creating a website where I want the index page to be designed differently than the secondary pages. How do I separate the CSS code for the index page from the rest of the CSS code? Do I just separate it out with comments?

    Sorry, I am just not sure how to organize the coding.

    Thanks for your time!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Andrew Nevins

    @anevins

    Forum moderator

    Add the body_class() function within your <body> HTML element.

    You can then identify pages with their page id classes.

    moeryan18

    @moeryan18

    Great, thank you. I know it’s a really basic question, but it’s my first website I’m trying to do with WordPress and I’m basically styling/designing from scratch.

    Much appreaciated!

    Moderator Jose Castaneda

    @jcastaneda

    THEME COFFEE MONKEY

    One way of doing it would be creating two different stylesheets and loading them through a conditional test. Not sure if you are PHP savvy but that is one way. Using comments is also another way of separating the code and is a great way of documenting why you did what you did for future reference.

    moeryan18

    @moeryan18

    Hi Jose,

    No I’m not very PHP savvy, only slightly familiar…thanks for the tip though, I will maybe learn in the future. Thanks again!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Style Sheet Coding’ is closed to new replies.
Skip to toolbar