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

6 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

Leave a reply