PDA

View Full Version : Setting Up Alternative Headers on your posts using WordPress



shrnmlss6
27 Aug 2011, 01:21 AM
Might be useful to you.....

One of the things that you might have wanted to do if you have a website that runs using WordPress is to actually show different headers on different pages of your website. For example, you might want to show a certain header on your homepage and then a different header on the rest of your website. This header might want to have links to Facebook or Twitter etc.

Doing this is actually relatively easy to do, despite many of the online tutorials saying that it isn’t. So here’s what you do:

The very first thing that you need to do is to actually create a copy of your header file. This means that you need to download the header.php file that is currently being used using an FTP client. After this, rename the file as header2.php or something like that and re-upload it to the server. Make sure it’s the same directory as the location of the original file.
Next, you need to login to WordPress through your admin panel and then click ‘Appearance’ then ‘Editor’. Then, you need to click the file named ‘single.php’ which is one the list on the right hand side of the screen.
After you click this, you should see the HTML content of that particular file and now, you need to location the <?php get_header(); ?> part of the code.
Once you have found this snippet of code in the page, you need to actually replace it with <?php include(TEMPLATEPATH.’/header2.php’); ?>
Once you have done this, you will simply need to save the changes that you have made and then check your site to see if it has worked. If it has worked, you should see the header2 show up on the homepage whereas the original header will show up on the other pages. You can then edit header2 as you wish so that it shows up as you like on the homepage.

It really is that simple and there are a variety of cool things you can do by doing this on your website. We will leave it to you to get creative with the idea now.

shrnmlss