35 Responses to “Custom Page Templates – Calling An External CSS File”

This page contains comments from the Custom Page Templates – Calling An External CSS File article.

  1. Sarah@Home Teeth Witening says:

    Great post on custom page templates in wordpress I do this all the time with an iframe plugin to embed amazon astores on a page… although i’m a little less elegant about it.. i just edit the page.php source to take out the call for the sidebar then change the post content width for the page content in the css.. it may not be pretty but it works for what I need as I’m not adding a lot of “pages”. I’ll try your solution on my next setup.

  2. I have been lucky and not need to change the header! I’ve used page templates mostly for making pages for search results and cutting out sidebars, which is slightly easier for a wordpress dummy like myself. :)

  3. felix@Hectic Capiznon Bloggers 2009 says:

    Glad that you made a new post and this customizing WP page tips is really very useful but I need to get over with the code again and again so that I could understand it well. I will just ask you later if I really can’t go with this code. Thanks for this.

  4. Reisefreak says:

    I have been lucky and not need to change the header! I’ve used page templates mostly for making pages for search results and cutting out sidebars, which is slightly easier for a wordpress dummy like myself.

  5. Great post really detailed I have had so many problems dealing with CSS files you have no idea lol

  6. Rotwein says:

    thanks for your solution, i made it on another way but your solution is way easier.

  7. If you are going to use this statement:

    # ID == 7830) {
    # echo ”;
    # }
    # ?>

    where would you add the id on the template and what would the code be.
    Cheers

  8. This is quite helpful for those looking to build more template files. Thanks!

  9. I didn’t know about the “add_action” function that WordPress had. But, it is good to know that I can now call the header without making a 2nd header file for a different template.

    A good example using custom template is to adjust one template for “Google Adsense”. Theres no choice in doing it, and in my opinion, better than using a premade template by Google.

  10. The Nooge@Unsigned Musician Radio says:

    I’m going to be honest here, those CSS files make me want to punch someone in the face…

    I’m not exactly trained in any form of programming, but with our tech guy being taken off our website from time to time it’s kind of left up to me to update/make changes…and CSS gives me hell…

    And after reading over your post…i’m still lost…which is par for the course!

  11. This makes it easier, but I still think I need to get back in class! Thanks Stephen!

  12. felix@sulumits retsambew says:

    I actually make use of this solution on my new web site I build. All of your tips are really coming all in handy. Thanks.

  13. Great stuff , i’ve been learning css as of recently so this helped with answering a few things i haven’t been able to figure out.

  14. Thanks for the clear instructiong. I’m just about to start on a brand new WP based site and have been looking for good ways of ‘individualising’ pages.

    I assume you weren’t happy with the plugins out there? (which I’ve not looked at yet)

  15. Luke@Corner Sofas says:

    OK, that solution is quite beautiful from a coding point of view. I would have gone for the IF approach in the header.php since I didn’t know any other way.

    So I guess add_action has many other uses?

    BTW, the comment before this one shows April 21 as the date, but today is only the 20th.

  16. Cheers m8, just what i was looking for css code is always killing me, everything shoud be wysiwyg :P

  17. It’s really important that people avoid inlince CSS wherever it’s possible. I begin to realise this more and more since I’ve started working in SEO.

  18. Print Matt says:

    Thanks for posting these solution. I can now add some business card templates to my blog. Though I’m a mediocre at programming, I think I can work on this by trial and error. :)

  19. Uitvaart Verzekeren says:

    I wish I had read this post some weeks before, because I just did “Rejected Solution 1 – Don’t Use Header.php” to my website ;(

  20. T_T I love working with codes but I don’t think I can master anything. The things you can do with CSS are truly great but woe is me who can’t make it work for me. T_T

  21. Great tip for beginners, I did rejected option #2 myself. My designs are pretty simple though.

  22. I am not very good with codes, however after following your detailed blog, I think I will give it a go. Thank you for the help and I will give it a try, I am sure it will not look good.

  23. Jimmy @ stock charts says:

    Definately Increases productivity, lots of websites use the same element , no use recreating the wheeeeel!

  24. I had a few things that i wanted to change on my wp blog template. i could not figure out how. you shined some light on what i need to do

    thankyou

  25. Kasper@seo og webdesign says:

    Just started playing around with wordpress and study the possibilites.
    I see this blog is a nice ressource for me :)

    At least now i wont have trouble with CSS in WP, thanks :)

  26. Anna@Diety says:

    I can’t make heads or tails out of it, but i showed this post to my “webmaster” (my bf;)) and he said it’ll come in handy, so thank you :)

  27. sid@typeofattorney.com says:

    I am sort of new to the wordpress world and information like this really helps. The more i work with wordpress the more i like it, great platform.

  28. I currently have a navigation menu on every page of a 30 page site. At the moment, it is a hassle when I want to change the menu because I have to alter every page.

  29. Here’s to hoping I came to the right place for help. I tried the WordPress forums, but to be frank they are pretty poorly organized and it’s hard to find specifically what I’m looking for.

    I’m very new to programming. In fact I’ve got very little knowledge of it. I’ve made some minor modifications to my WordPress blog as well as quite a few mods to the phpBB forum.

    Anyhow, I like the basic layout of your blog and was wondering if you (or anyone here) might be able to help me out with a similar design.
    Here’s what I’d like to do:

    1. I would like to to have more room on the side for the ads.
    2. If possible, I’d like to put ads on the left on the blog content on the right.
    3. I would like to include the same ads on every page of my blog, not just the main page where all of the latest blogs are listed.

    Any help would be greatly appreciated. I’ve got you bookmarked and will check back often, as well as browse your other posts to see if I can stumble upon some answers.

    Thank a million.

  30. train horn says:

    I kinda don’t like working on codes but this will be an exception. It is very a helpful post for people like me. Very clear and detailed. It was easy to understand. :D be back for more.

  31. You certainly are giving your visitors a lot of precious info. External CSS file is the solution that I’ve been looking for. Great tutorial! Applying this to my theme right now – can finally finish and get it published. Thank you

  32. I was planning to setup a blog on wordpress so this post has been really very helpful. :)

  33. Charles Wong says:

    It is very useful for me. I visit your jobs listing China webstie. It is very interesting. if you need more job info in China, maybe I could help you.

  34. Hi All,

    I noticed a problem here (thanks Ken).

    The last two examples were using bloginfo rather than get_bloginfo which is needed if we are using Echo. The code should work now.

Leave a Reply

Anti-Spam Quiz:


Stephen Cronin

is Manager of Online Service Delivery at a Queensland Government department & has been a freelance WordPress developer/consultant since 2007
*Content on this site is my own and is not related to my employer

Hire me - I'm expensive, but I'm very good!

WordPress Plugins

Want a Custom WordPress plugin? See my Services page.

Greasemonkey Scripts

Visit my home page at Userscripts.org.