Every time I create a new page template in WordPress - for example category-news.php, or single-portfolio.php, I duplicate my header.php to call custom javascript libraries that won't be used elsewhere on the site.
so in category-news.php, I call my header like this: get_header(news); and in single-portfolio.php, I call my header like so: get_header(portfolio);
Then I create header-news.php and header-portfolio.php in which 85% of the code is the same. Now when I want to make a single change to my header, I have to change it in multiple files. It seems like I MUST be doing something wrong.
Is there a way to *extend* my header to keep "all the basics" + these two jquery plugins for a given post template?
Thanks for any advice. A google search is making me feel like I'm the only person in the world who has this problem so I must be missing something obvious, Thank, Matth
so in category-news.php, I call my header like this: get_header(news);
and in single-portfolio.php, I call my header like so: get_header(portfolio);
Then I create header-news.php and header-portfolio.php in which 85% of the code is the same. Now when I want to make a single change to my header, I have to change it in multiple files. It seems like I MUST be doing something wrong.
Is there a way to *extend* my header to keep "all the basics" + these two jquery plugins for a given post template?
Thanks for any advice. A google search is making me feel like I'm the only person in the world who has this problem so I must be missing something obvious, Thank, Matth
header.php
single-portfolio.php (at top of document)
category-news.php (at top of document)
That's exactly what I'm going to do. Thanks for the help.
In my header.php I'll do things like this:
It's all about the conditionals. Here are all of the different ones you can use (there are a lot!): http://codex.wordpress.org/Conditional_Tags
In your specific case, I would do something like this: