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.
This page contains comments from the Custom Page Templates – Calling An External CSS File article.

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!
Want a Custom WordPress plugin? See my Services page.
Visit my home page at Userscripts.org.
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.
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.
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.
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.
Great post really detailed I have had so many problems dealing with CSS files you have no idea lol
thanks for your solution, i made it on another way but your solution is way easier.
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
This is quite helpful for those looking to build more template files. Thanks!
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.
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!
This makes it easier, but I still think I need to get back in class! Thanks Stephen!
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.
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.
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)
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.
Cheers m8, just what i was looking for css code is always killing me, everything shoud be wysiwyg
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.
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.
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 ;(
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
Great tip for beginners, I did rejected option #2 myself. My designs are pretty simple though.
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.
Definately Increases productivity, lots of websites use the same element , no use recreating the wheeeeel!
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
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
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
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.
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.
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.
Hey, just wanted to give a quick update. I actually found a theme that suits all of the above needs I listed. I guess just talking it through led me to a solution. Thanks for giving me a sounding board!
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.
be back for more.
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
I was planning to setup a blog on wordpress so this post has been really very helpful.
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.
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.