WordPress

How To Implement Separate Headers For Pages in WordPress?

Admin Header for WordPress
Views

For all intents and purposes, WordPress is the de facto best content management system you can think of. While the web realm will continue to be populated with an array of new CMS platforms, going by the rate at which WordPress keeps on improving itself and taking strides towards empowered upgrades, the dominance of WordPress likely to continue.

Admin Header for WordPressThere are several differentiators that make WordPress a frontrunner among the website development platforms. To begin with, it is a robust system that artfully combines unprecedented flexibility to give us a solution that can be leveraged for muscular website development. Talking of flexibility, WordPress leaves a lot of scope for us to customize and tailor our websites to the varying business needs and market trends. It is common knowledge that trends and demands keep fluctuating and you can’t have a static approach to addressing your audience. Being linear and static is a direct way to the technological and financial grave for any business. The powerful waves of change dictate their own terms and as website owners, you have to roll with the punches. That’s exactly what WordPress capacitates you to do.

WordPress gives you that extra room to spread your wings and innovate without restraints. And this innovation can be domain-relevant. To elaborate the point, let’s consider a scenario where you feel that on the separate pages on your website, you need separate headers, since the header on the homepage is a misfit for one of the inner product pages. Well, if you are wondering at what times do such situation arise, here are a few examples for your due consideration:

When Do You Need Different Headers

  • For Websites with Disparate Themes

Let’s say you are running a website that allows the users to play different games, depending on which section of the website they are on. Now, on such a website, instead of having the same header throughout the site, it would serve you well to have an individual header for each game so that it fits the theme and tonality of the game. With segregated headers, it would also be easier for your users to identify the pages in respect to what they represent and avoid any possible confusion.

With the header of a particular page making it pretty much apparent what the page is all about, the users find it more in sync with what you are offering and that shows in the website’s stats like bounce rate, avg. time spent per page, etc.

  • For Websites that Need Different Set of Menus

There is no dearth of webmasters who feel that their homepage calls for an entirely different set of menu items as opposed to the inner pages of the same website. This is again a situational need where the website may be representing different breadths of information and including menu items of all on the homepage might make it look cluttery. Thus, having different menu for the homepage and inner pages works well for such sites.

As a solution to this conundrum, you can have different menus built right from the backend and once they are fully furnished, they can be designated to the respective headers.

For Websites that Need Different Headers for Segregated Marketing

Marketing products via a website needs a highly focused and precise approach. You can’t have the same marketing strategy to promote diverse products on your site. Each range of product requires a different strategy and setup, and it should reflect in the visual interface. Again, headers come into play here as it would serve you remarkably well if you have a very product-centric header of a particular page, it makes it all the more easier for you to string up a marketing strategy. The pages with the most relevant header can host a potent marketing strategy that should more than do its job of promoting an offering. You can have an email subscription box right on the header that is exclusive to the particular product page.

Now, having separate headers for separate pages isn’t as difficult a task as you deem it to be. It rather involves few seamless steps. You will have to play around with some simple enough PHP code and the job will be accomplished without any fuss whatsoever.

Now that we have extensively discussed how awesome WordPress is, how it can be extended beyond the defaults and most importantly, why separate headers can really power you to make it count, let’s segue on to some “how to” behind the separate headers. In the following section, we will take a look at how you can have different headers for your website pages.

Creating Separate Headers for Separate Pages

To begin with, we will first create a PHP file and assign it a name that is more identifiable. In our case, let’s name it my-new-header.php and it is in this file that we’ll need to insert a custom code.

We will create a new page template file and name it post.php. The default code for the header will be replaced by the following code:


if(is_post(19))
 {
 get_header('films');
 }
 else
 {
 get_header();
 }
 ?>

In the code above, the get_header functionality plays a significant part. Also, with the new custom file we created, my-new-header.php, we have used if(is_post(19)) as an ID of the post on which we wish to build a separate header. Following that, get_header(‘films’) is the alias we made use of when we created the my-new-header.php example header-films.php.

To put it more simply, the code we have written intimates WordPress that as and when a user accesses the post ‘films’, it has to display the file header.films.php so that the header on this post is what we have created. If you haven’t created any file in the first place, the default header file will be brought into action.

Making Tweaks to the Already Existing Headers

While there is a provision for you to create new headers, another option that you might find to your liking is the ability to edit the existing headers and add to them a new character. The procedure to do so is even simpler than the one required for creating new header. An image editing program of the likes of Photoshop can do the job for you. Use it to edit the image of the header, save the edited image and change the file name before you reload it again.

In order to find the image, all you got to do is to right-click on the header image and select View Image. You will be presented with the complete path of the image and also of its location on the web server.

Wrapping up, it thus can be deduced that the default features and elements of WordPress can be turned into so much more, only if you have the will and the requisite knowledge, you can really make your website branch out and inculcate some remarkably effective features. As for adding separate headers for separate posts and sections of your website, we hope the above tutorial gives you a clear eyed idea on the steps you need to perform for ensuring the same.

What is your rating for this article?
- Total: 0 Average: 0

Leave a Reply