• 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?

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • 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().

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

    Thread Starter micbow

    (@micbow)

    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

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

    Thread Starter micbow

    (@micbow)

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Stylesheet only for single pages’ is closed to new replies.