WordPress.org

Ready to get started?Download WordPress

Forums

Include extra files on Custom Page Template (5 posts)

  1. Patrick Rauland
    Member
    Posted 3 years ago #

    Hello,

    I have a site that uses two different page templates. I want to include an extra stylesheet in the special template but I don't know how to do that with just one header.php file.

    I would imagine there would be some sort of hook for me to use. Something like is_page_template("") which would determine if the page is using a certain template and then use php and conditional statements to include an extra file.

    Any suggestions?

  2. esmi
    Forum Moderator
    Posted 3 years ago #

    Why add an extra stylesheet? Why not just add page-specific style to the main stylesheet?

  3. pidi233
    Member
    Posted 3 years ago #

    in the header.php you can include all the stylesheets that you like. just copy the link twice and change the path to the new css file.

  4. alchymyth
    Forum Moderator
    Posted 3 years ago #

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

    why are you not searching the codex if your idea of a conditional tag exists?

  5. Patrick Rauland
    Member
    Posted 3 years ago #

    @esmi I could add page specific styles but I like to break a large style sheet into several smaller ones for readability and making the page lighter. In this case I have a totally different layout so there is no need to download an extra couple hundred lines when you don't have to. For small page to page changes I tend to have one style sheet that holds all of those.

    @pidi233 That was my fall back plan. :) . I figured that I should put a little effort into making the page as light as possible.

    @aslchymth Thank you! I knew it must be there. It is exactly what I need. I did search the codex but I must be bad with keywords as I was unable to find it. Thanks for the help.

Topic Closed

This topic has been closed to new replies.

About this Topic