
Quick Steps To Add Header And Footer Code To Your WordPress Website.
There may be situations when you are willing to customize your WordPress website. But this may only be possible if you edit the underlying code of the present theme. This can be achieved by adding code to header and footer which you may function accordingly. Various tools and scripts require you to add code to the WordPress site’s header and footer.
Are you willing to add code to the header and footer but don’t have exact steps to follow? No more worries. Here we will be discussing two methods by which you can easily add code. You may choose any of these two procedures according to the convenience.
Let’s get started.
The Two procedures to add code to the header and footer are as follows:
- To add code through WordPress plugins.
- To add Manually.
1. To add code through WordPress plugins.
As every WordPress user knows how convenient it is to add plugins to our WordPress website, this also brings functionality to add code to header and footer.
We may simply add a plugin named “HEADER AND FOOTER” created by the developer Stefano Lissa. This is a free plugin which may quickly be added by WordPress plugin directory.
To add this plugin perform the following steps:
i) Login to your WordPress admin panel (http://yoursite.com/wp-login.php)
ii) Look for plugins and click on it.
iii) Click on add new.
iv) Search for the plugin “HEADER AND FOOTER” and install it.
v) Once it’s installed, activate it.
vi) Now you can easily access it under the settings menu which is at the admin’s sidebar.
vii) Now you can start adding snippet code according to your will either at header or footer.
This is the easiest method to add code to header or footer. But this can be done manually too which we will be discussing in the next point.
2. To add code manually to header or footer.
i) Firstly, Prepare Code snippets.
– To add code to header, use the code given below:
/* Description of the code snippet */
add_action('wp_head', 'your_function_name');
function your_function_name(){
?>
PASTE HEADER CODE HERE
<?php
};
– To add code to footer, use the code given below:
/* Description of the code snippet */
add_action('wp_footer', 'your_function_name');
function your_function_name(){
?>
PASTE FOOTER CODE HERE
<?php
};
ii) Go to the WordPress dashboard.
iii) Select appearance and click on editor.
iv) Open the functions.php file and paste the prepared snippet code at the end of the file.
v) Click Update file.
Conclusion– We have discussed both the methods for the customization on your WordPress website. You may opt any of these two methods and let us know which one is more preferable to you in the comment section below. We hope that we made justice to your problem.
About us: Baymediasoft is a web development company assembled with highly technical and experienced WordPress developers. Our agile developers put in their best to satisfy clients’ project’s requirements.
If you want to hire our WordPress developers, you may contact us, and we will get back to you as soon as possible.





