Stylesheet only for single pages (5 posts)

  1. Micbow
    Posted 3 years ago #

    Hi I was wondering how to get single pages to only to use an alternative stylesheet I've created?

    I've created a new header just for the single pages, header-single.php, and designated the new stylesheet there but it still accesses the main stylesheet. How do I stop it from doing that?


  2. JungleSpace.net
    Posted 3 years ago #

    You would need arrange the css file such that it loads after the main css. In other words put the line

    <link ...>

    after the main css line.

    Use can use logical statement to only load CSS on specific pages using functions like is_page(), is_single().


  3. Micbow
    Posted 3 years ago #

    Hi, Thanks for the answer.

    I don't want to load the main css on the single pages at all as it has different values for the body{} css and contains all the css that is required for the single pages.

    You see I want to make the single pages mobile friendly so having one stripped down stylesheet that is the only stylesheet that is loaded is what I am trying the achieve.

    Therefore it looks as if adding functions to include or exclude stylesheets is what's required?

    How would you write the function to do this?

    Thank You

  4. JungleSpace.net
    Posted 3 years ago #

    if( is_single() ){
    //call stylesheet
    //call main stylesheet

  5. Micbow
    Posted 3 years ago #

    Thank for that. I'll give it a go.

Topic Closed

This topic has been closed to new replies.

About this Topic