Head & Footer Code

Description

Let we say that you have been told to add some custom code (HTML, JavaScript or CSS style) to page’s <head> (like site verification code, custom styles, webfont link, etc), or just before </body> (like pixel tracking, analytics code, heatmap code, etc), but you are not programmer. Then you can use Head & Footer Code to do that.

Simply go to Tools → Head & Footer Code in your website admin dashboard, and insert custom code to HEAD or FOOTER section (depending what you have to do).

If you have to insert some custom code specific for individual article (post, page, custom post type), then you can use Article specific metabox while you editing post/page/custom post type (check out Screenshots). There you can also set should that specific code be appended to site-wide code defined on ToolsHead & Footer Code, or should be overwritten.

Works or broken?

Please, consider to vote for this plugin. When you vote for broken, be so kind and tell in the Forum what is broken. Maybe I might be able to fix it to make the plugin also work for you.

I need your support

It is very hard to continue development and support for this and my other free plugisn without contributions from users like you. If you enjoy using Head & Footer Code and find it useful, please consider making a donation. Your donation will help encourage and support the plugin’s continued development and better user support.

Features

  • Set site-wide custom content for head page section (before the </head>)
  • Set site-wide custom content for footer page section (before the </body>)
  • Set article specific custom code for head page section (before the </head>)
  • Set article specific custom content for footer page section (before the </body>)
  • Choose priority of printed custom code to head/footer sections (lower number mean far from </head> and </body>, higher number means closer to </head> and </body>)
  • Choose which post types will have enabled article specific head/footer fields
  • Choose should article specific head/footer code be appended to site-wide code, or will replace site-wide code
  • Site-wide section located under Tools > Head & Footer Code
  • If you have enabled WP_DEBUG constant in wp-config.php, you’ll see site-wide and article specific entries in page source code wrapped to comments.
  • Support Multisite environment.

General settings, including HEAD, FOOTER global code and priority, have been saved to WordPress option auhfc_settings.
Each post/page/custom post type specific HEAD and FOOTER code have been saved to post meta _auhfc.
On plugin uninstall these data is also deleted from database.

Screenshots

  • Head & Footer Code box in Plugin search results
  • Site-wide settings page
  • Article specific metabox
  • Example of custom code inserted to HEAD section (site-wide with appended article specific)
  • Example of custom code inserted to FOOTER section (site-wide with appended article specific)

Installation

Installation of this plugin is fairly easy as any other WordPress plugin.

Standard procedure

  1. Go to PluginsAdd New.
  2. Search for head footer code.
  3. Enter to Search Plugin field had footer code and press Enter key.
  4. Locate plugin Head & Footer Code and click Install Now button.
  5. After successfully installed plugin click link Activate Plugin.
  6. Visit the ToolsHead & Footer Code.
  7. Add the desired code to proper section.

FTP procedure

  1. Unpack head-footer-code.zip
  2. Upload the whole directory and everything underneath to the /wp-content/plugins/ directory.
  3. Activate the plugin through the ‘Plugins’ menu in WordPress.
  4. Visit the ToolsHead & Footer Code (Settings link).
  5. Add the desired code to proper section.

FAQ

Installation Instructions

Installation of this plugin is fairly easy as any other WordPress plugin.

Standard procedure

  1. Go to PluginsAdd New.
  2. Search for head footer code.
  3. Enter to Search Plugin field had footer code and press Enter key.
  4. Locate plugin Head & Footer Code and click Install Now button.
  5. After successfully installed plugin click link Activate Plugin.
  6. Visit the ToolsHead & Footer Code.
  7. Add the desired code to proper section.

FTP procedure

  1. Unpack head-footer-code.zip
  2. Upload the whole directory and everything underneath to the /wp-content/plugins/ directory.
  3. Activate the plugin through the ‘Plugins’ menu in WordPress.
  4. Visit the ToolsHead & Footer Code (Settings link).
  5. Add the desired code to proper section.
Why another one custom code plugin?

Because all other similar plugins could not satisfy my requirements. In general, they have too much features or lack some features I need.

Reviews

best but only for single site

this plugin is awesome but unfortunately it only works for inject manual for each web on multisite, this could be better if also can inject mandatory for all header/footer web on multisite wordpress

Read all 11 reviews

Contributors & Developers

“Head & Footer Code” is open source software. The following people have contributed to this plugin.

Contributors

Translate “Head & Footer Code” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.

Changelog

1.0.7

  • Compatibility check: Tested for WordPress 4.7.1
  • UX: Add right hand sidebar on global settings page with links to donate, FAQ, Community support and plugin Reviews page.
  • UX: Set monospaced font for textareas on global settings and article pages

1.0.6

  • Fix: PHP Notice: Trying to get property of non-object in \wp-content\plugins\head-footer-code\inc\front.php on line 41.
  • Fix: Overwrite footer content for post/page if post/page template after content have another WP Loop query (like recent posts WP Widget in RHS sidebar).
  • Optimize: Avoid reading post meta if not singular or post type not enabled
  • Tested in Multisite environment (main and other network websites) on WordPress v4.5-alpha-36504 and theme Twenty Sixteen v1.2-alpha.

1.0.5

  • Enhance: Add uninstall routine to make some housekeeping on plugin removal.
  • Enhance: Add post type in debug comments.
  • Readme: Test on WordPress v4.4-beta1 and updated compatibility.

1.0.4

  • Fix: PHP Warning: in_array() expects parameter 2 to be array, string given (introduced in v1.0.3)

1.0.3

  • Change: Make even default WP post types post and page optional for page specific head/footer code

1.0.2

  • Change: Replace PayPal donation links to prevent account limitations if plugin is used on website that violates PayPal’s Acceptable Use Policy

1.0.1

  • Fix: PHP Notice Trying to get property of non-object
  • Optimize: Remove attachment post type from available to select as no reason to have custom head/footer code on attachments
  • Optimize: Settings code cleanup

1.0.0

  • Initial release.