AddFunc Head & Footer Code

Description

Allows administrators to add code to the <head> and/or footer of an individual post (or page or other content) and/or site-wide. Ideal for scripts such as Google Analytics conversion tracking code and any other general or page-specific JavaScript. A very simple, reliable and lightweight plugin.

Screenshots

  • Simply paste your code into one of these two fields and it will be included on every page of your website.

  • Add your code to these fields respectively and it will output specifically to this page, post or custom post type. Optionally replace or remove the site-wide code on any individual post or page.

Installation

  1. Upload the entire /addfunc-head-footer-code folder to the /wp-content/plugins/ directory
  2. Activate the plugin through the Plugins menu in WordPress
  3. Add code site-wide in Settings>Head & Footer Code or on individual Pages/Posts using the Head & Footer Code meta box when in edit mode in a page (or any post type)

FAQ

Installation Instructions
  1. Upload the entire /addfunc-head-footer-code folder to the /wp-content/plugins/ directory
  2. Activate the plugin through the Plugins menu in WordPress
  3. Add code site-wide in Settings>Head & Footer Code or on individual Pages/Posts using the Head & Footer Code meta box when in edit mode in a page (or any post type)
Can I add Google Analytics or other tracking code snippets to the ⟨head⟩ tag of my website?

Yep! That’s what AddFunc Head & Footer Code is made for.

Can I add code snippets to the ⟨head⟩ tag or footer of a specific Post or Page?

Yep! That’s what this plugin is made for.

Does AddFunc Head & Footer Code work on custom content types, the same as they do on Posts and Pages?

For the site wide code yes, as long as the theme is set up properly with the wp_head() and wp_footer() functions. For individual custom content type “entries” (as we’ll call them) it will work as long as the custom content type (or custom post type more precisely) is set up in the standard way, so that WordPress will recognize that it needs to add all the usual meta boxes to it. Basically, it will work in a standard setup.

Where does the head code output?

Wherever wp_head() is located in your theme.

Where does the footer code output?

Wherever wp_footer() is located in your theme.

Will AddFunc Head & Footer Code work if there is no `wp_head()` or `wp_footer()` in my theme?

Wherever one of those functions is missing, your code will not be output there. But omitting one of them does not stop the other one from working. AddFunc Head & Footer Code will also save your code regardless. It just can’t output your code without the presence of those functions in the theme.

Does it really require WordPress 3.0.1 or later?

I have not tested it on earlier versions, but I believe wp_head() and wp_footer() have been a part of WordPress since the very beginning, so it should work on any version. Feel free to try it out and let us know if it works! 🙂

Does AddFunc have a website?

Yes. addfunc.com

Reviews

Perfect for Facebook Pixel

This plugin is spectacular! It’s the only plugin that I could find which would allow me to add different code into the head of my entire site, and slightly different code into individual products, posts or pages. Perfect for Facebook Pixel Event tracking, like Add to Cart etc.

I tip my hat to Addfunc devs, well done!

Ideal for integrating code overall AND per page

There are many plug-ins available for integrating code in the whole website.

This is the only one I can find that also has the option to integrate code per page. This is often needed for i.e. the Facebook pixel.

Thank you for making this plug-in!

Read all 20 reviews

Contributors & Developers

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

Contributors

Changelog

1.5

13-Sep-2017

  • Adds ability to set the output priority of the head code. Thanks to John Irvine at RD Technology Solutions for the suggestion.
  • Adds ability to set the output priority of the footer code.
  • Changes the metabox to a lower priority so it sits at the bottom by default instead of the top. Thanks to @enfueggo for the suggestion.

1.4

3-Apr-2017

  • Adds option for individual post code to replace the site-wide code:
    • Head and footer managed independently of each other
    • Individual post code appends to site-wide by default
    • Check the Replace Site-wide Head/Footer Code checkbox to replace or remove the Site-wide code for the respective area
  • Fixes post meta fields:
    • No longer saves post meta fields when not needed
    • Deletes post meta fields if empty when saved/updated

1.3

23-Jun-2015

  • Corrects the generated path to options.php, so that the settings page can be found even on installs where the plugins directory is not at the standard /wp-content/plugins location.

1.2

19-Jun-2015

  • Discovered addfunc-head-footer-code.php was saved with text encoding Western (Mac OS Roman). ~>:( Changed to Unicode (UTF-8).
  • This was probably changed during a recent update on the plugin’s tags (the tags for the WordPress Plugin Repository), so maybe two weeks ago. Previous downloads should have been UTF-8.
  • Also changed version 1.1 to UTF-8 because leaving a Mac OS Roman version in the repository would be pointless. So 1.1 and 1.2 are the same, except for the readme.txt.

1.1

28-Nov-2014

  • Fixes meta box nounce.
  • Changes all references to Average (including but not limited to “avrg”, “average”, etc.) to relate to AddFunc (changing project name).
  • Changes a few other function and variable names for namespacing purposes.
  • Submitted to WordPress under the name AddFunc.

1.0

7-Aug-2014

  • Includes readme.txt.
  • Submitted to WordPress.

0.4.1

6-Aug-2014

  • Code cleaned up (mostly comments removed).
  • Excludes unnecessary file: style.css.

0.4

8-Jul-2014

  • Bug fix: replaced “my-meta-box-id” with “avrghdftrcdMetaBox” (duh).

0.3

27-Oct-2013

  • Hid Head & Footer Code meta box from non-admin users.

0.2

15-Oct-2013

  • Adds a Head & Footer Code settings page for site-wide code (for admins only).

0.1

14-Aug-2013

  • Adds Head & Footer Code meta box to all pages, posts and cusom post types.
  • Saves Head & Footer Code entry to the database as custom fields.
  • Outputs code to the website in wp_head() and wp_footer().