Feb 23

A customer asked me to make a bunch of changes to the theme of a very active web site. Since I couldn’t risk breaking the site or having it look strange for any amount of time, I had to find a way to work on a new set of header and footer files without disrupting the active theme. I found the simple answer here:

WordPress support – How to swap a theme

Basically you’re just adding a test to the page template which tests what page you’re on, and shows a different header and footer for that page. Here’s the little code snippet from the page:

<?php
if(is_page('somepagename')) {
get_header('test'); // Looks for a file called header-test.php
}
else {
get_header(); // Looks for regular header - header.php
}
?>

If you wanted to make the home page have different header and footer files, you could use the is_home() function instead of is_page.

Share: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Google Bookmarks
  • Bloglines
  • Furl
  • Slashdot
  • YahooMyWeb
  • StumbleUpon
  • Taggly
  • Technorati

Leave a Reply