Different Style for different templates (3 posts)

  1. samwatts
    Posted 2 years 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
    Posted 2 years 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()


    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. Michael
    Forum Moderator
    Posted 2 years ago #

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


Topic Closed

This topic has been closed to new replies.

About this Topic