WordPress.org

Forums

Different Style for different templates (3 posts)

  1. samwatts
    Member
    Posted 1 year ago #

    Is it possible to use a different style sheet for a different template?

    E.G. style-blue.css with full-width-template.php
    style-grey.css with home-template.php

  2. martcol
    Member
    Posted 1 year ago #

    When you view the source in a published page take a look at the body element. Many themes add classes to the body element that are generated using body_class()

    http://codex.wordpress.org/Function_Reference/body_class

    I have a template splash-page.php. When that page is generated, I can target the page in my CSS by using:

    .page-template-splash-page-php as the beginning of the selector.

  3. alchymyth
    Forum Moderator
    Posted 1 year ago #

    you could use a conditional statement based on is_page_template() to link the stylesheets in header.php

    http://codex.wordpress.org/Function_Reference/is_page_template

Topic Closed

This topic has been closed to new replies.

About this Topic