Add to Header

2010-01-16 @ 14:49

The problem

If you need to add a stylesheet, a javascript file or Google Analytics code you normally need to edit your theme header.php file. If you do that your changes will be overwritten if you upgrade your theme.

The plugin

In short

  • Birth date: 2009-08-15
  • Last updated: 2009-08-15
  • Version: 1.0
  • Tested with version: 2.8
  • Requirements: PHP5

Download

  • Download from: devdevote.com
  • Download from: wordpress.org (coming soon)

Benefits

Add additional code to your header WITHOUT editing your theme:

  • Stylesheets (CSS)
  • Javascript (JS)
  • Google Analytics
  • Metadata
  • Anything else

Example usage

  • Change your downloaded theme visually without changing it, by adding an extra stylesheet. If you update your theme your changes will still be intact.
  • Add Google Analytics without changing your theme. If you update or change your theme, Google Analytics will still be there.

Screenshots

Add to Header

Installation

  1. Upload the FOLDER ‘add-to-header’ to /wp-content/plugins/.
  2. Activate the plugin ‘Add to Header’ through the ‘Plugins’ menu in admin.
  3. Go to ‘Settings’ and then ‘Add to Header’ to add header code.

Changelog

  1. 1.0 – Initial release.

Known issues

None reported so far.

Possible future features

  • Add footer code through wp_footer().
  • Add shortcodes to insert code within posts / pages.
  • Add multiple codes to header, footer and shortcodes.
  • Add functions to themes to add code.
  • Add PHP code.

Contribute

  • Report bugs.
  • Report if it works with other versions with WordPress.
  • Spread the word. Blog about it, tell your friends, link to this page and so on.
RSS-feed for comments

19 replys to “Add to Header”

  • baron »
    2009-08-16 @ 12:24 e m

    Works great, thank you

    Reply
  • MacBoy
    2009-08-19 @ 12:35 e m

    Can you allow us to add PHP code into the Header via this plugin ?

    I’d want it to be the code executed prior to the tag in the header.

    Reply
  • Shane »
    2009-09-02 @ 1:36 e m

    I am trying put the photo that is in my sidebar into the header but when I use this plugin, the photo doulbes ie its put 2 there, it duplicates them, any idea why this would be?

    Reply
    • admin
      2010-01-17 @ 2:15 e m

      I have no idea. The plugin just takes the code written in the textbox and add it to the header through the function wp_head. Check the code again to see if you have written the code two times by mistake?

      By the way, text and photos should not be between the head-tags. It should be somewhere between the body-tags. Scripts, CSS, metadata and so on are head-stuff. Images are not.

      Reply
  • OP351net »
    2010-01-10 @ 2:50 e m

    Great! It’s working on the WP-v2.9.1… Thanks.

    Reply
  • Eric
    2010-05-21 @ 5:14 e m

    This works wonderfully, thanks! But I’m curious…the default placement of an added chunk of code is in front of/above the current header. I’m wondering if there’s a way to place the code directly after the current header…a blog-wide subhead as it were. Something between the header and the content.

    Reply
  • John
    2010-08-30 @ 9:12 e m

    Great idea and serves a real need but wondering if there is a way to have it load after all other plugins so my style include could overwrite previous includes without me modifying their code or my own header file directly. Maybe this is more of a plugin load question…

    Reply
  • john
    2010-08-30 @ 9:32 e m

    …in response to my previous comment, i see that plugin order is determined by plugin name (alpha ordered) so renaming to z_ + name fixed it for me. thanks again for your helpful plugin!

    Reply
  • Robert Merrill »
    2010-10-14 @ 5:20 e m

    Any chance you know of an ”add to footer” plugin (or would write one)? It’d be cool if this plugin allowed you to add to the header and the footer in the same plug. Nice work.

    Reply
  • computer repair boca raton »
    2010-10-31 @ 5:45 e m

    Hi, I like your theme… did you purchase it or is it unique? I am in search of a theme like this for my website but haven’t discovered anything as nice as this.

    Reply
  • Add to Header | Scripts United »
    2011-02-03 @ 5:59 e m

    [...] Translate Widget für WordPress »Add to HeaderPubliziert 19. Februar 2010 | Von khkAdd to Header von devdevote.com fügt über eine Textbox im Adminbereich beliebigen Code in den Header des Blogs [...]

    Reply
  • Freddie Markstrom »
    2011-04-13 @ 2:25 e m

    Thanks for this post. It is very useful and time saver.

    Reply
  • Tom
    2011-05-26 @ 9:25 e m

    This plugin is not working in WP 3.1.2

    Reply
  • Yves
    2011-06-19 @ 11:15 f m

    Works fine in WordPress 3.1.3. !
    Great Job, you’ve done here, Thank you !

    Reply
  • Rasika »
    2011-07-06 @ 12:53 e m

    How do we remove the added code ?

    Reply
  • Two additional ways to get banner management on WordPress | chimac.net – Stuff worth knowing about »
    2011-07-17 @ 12:35 f m

    [...] sec­ond one and the one I am using now is Add to Header. It is fan­tas­tic and even though devel­oped long ago, still com­pat­i­ble. He did a great [...]

    Reply
  • Preston Crawford »
    2011-07-20 @ 6:19 e m

    Trying to use this with my site and I’m not seeing a ”settings” link by the plugin. Any idea why this might be?

    Reply
  • Donald Haas
    2011-08-08 @ 6:13 e m

    Jens,

    Nice work, IMHO.

    Question: If I have already created a header.php file in my child theme, will ATH put its code there or in the WP header.php file? Or, is there a way to direct the plug-in to a specific header.php location?

    Thank you for your time and attention.

    Best,

    don

    Reply
  • Jennifer Crane »
    2011-08-17 @ 11:19 e m

    I added my banner java to the add to header plugin, but is there anyways I can get the banner to display directly below the header image and menu, and above the content?

    Reply

Leave a reply