Quantcast
Channel: WP Cypher
Viewing all articles
Browse latest Browse all 104

Managing WordPress Custom Header Footer Information

$
0
0

I like may WordPress bloggers got used to adding custom script information directly to the header.php or footer.php as it was simple and didn’t rely on another plugin to be loaded and executed to run a page or post, this helped reduce overhead and keep pageload times leaner than using too many plugins.  However when using WordPress themes one must consider that theme upgrades to occur and if you are putting manual code into the header.php, single.php, index.php or footer.php manually or any other theme file manually for that matter you will lose your updates when you update your theme which requires you to manually remember what you put in, extract it and put it back in your new theme files.

image

This is where something like the great Header Footer WordPress plugin can help, this plugin does more than just custom Header and Footer code insertion however so don’t let the name fool you. 

Download Header Footer from the WordPress Plugin Depot (it is free)

Install and Activate it.

Click on Settings –> Header and Footer

Move any custom code from your header.php into the Page Header and Footer tab.

image

Note, there is a separate section for only header code on the homepage, most bloggers will want header scripts to be called on every page so unless you have something specific on homepage only you will be posting your custom header script code in the 2nd box called “Code to be added on HEAD section of every page”.

If you manually update your theme to add share buttons or banners for products, then you can also leverage the Post content tab and add custom script code or information to the top or bottom of posts as well.

image

You also get the same settings for page content if you want separate banners to show up on the pages vs the posts for example.

Overall this plugin is lean, efficient and in my testing did not cause any extra pageload time compared to putting the same script code in the header.php directly.  This now proofs my theme from upgrades so that I don’t lose that IZEA Media script code, Twitter anywhere script code or other custom script code that was manually inserted into the header.php file.

If you have a theme that regularly receives updates as many of the free Themes do in the WordPress archive like Graphene, Suffusion, Twenty Twelve…etc then you may want to consider the Header and Footer WordPress plugin that lets you add custom script code to your WordPress header, footer, page, post and more so that automatic Theme upgrades won’t blow away your custom code.

This is an original article from WP Cypher Copyright 2012

Author information

dragonblogger
dragonblogger
IT Security Manager who is also a part time technology blogger and loves all things Wordpress and Social Media

Viewing all articles
Browse latest Browse all 104

Trending Articles