Custom Headers & Footers

Cover Image

This plugin was made for the company iHealthSpot so the marketing team could add any kind of tag on the header or footer of a page.

The main reason to create it as a new plugin instead of using one of the existing ones where:

So this plugin was created to solve those issues, and used an interface that was easier for them to use.

Technologies Used

This is very simple plugin. It just adds content using the wp_head and wp_footer WordPress Hooks.

For storing the code I created a new custom post type the supported additional meta information:

The hard part of this plugin was the creation of a black list of code patters that could not be added. This was achieved by using regular expressions that look for pre-defined patters on the code, and if one of those patters was found then that code would not be added to the header or the footer.


Custom Headers & Footers with JavaScript code

Adding JS code

Custom Headers & Footers with CSS code

Adding CSS code

Live Coding

Here is the live coding sessions of the development:

This is for demonstration purposes only, there is no sound or explanation of the process.