Download WP Hooks Now →

What It Is

WP Hooks is a plugin for WordPress that allows you to add JavaScript, HTML, etc. (not PHP, maybe in a future release) to your header and footer without modifying your theme. WP Hooks uses the wp_head() and wp_footer() hooks built in to WordPress to add content to your header and/or footer. It’s great for those who have custom JavaScript, CSS, or other code (Google Analytics, meta tags, etc.) in their header or footer and don’t want to copy that every time they change themes.

Screenshots

Frequently Asked Questions

I’ve added content but why is it not showing up in my header/footer?
WP Hooks assumes that wp_head() and wp_footer() are in your theme. According to the WordPress documentation on wp_head():

This hook is theme-dependent which means that it is up to the author of each WordPress theme to include it.

If one of the hooks is not in your theme, you could add it yourself by adding <?php wp_head(); ?> to your header.php file of your theme or <?php wp_footer(); ?> to footer.php.

Changelog

1.0.3 – March 3, 2009

  • The options page (still) wasn’t working in WordPress MU. I’ve added in a check to see if the new function settings_fields() is available, and if it is, the options page uses that. If settings_fields() is not available (older WP versions) the wp_nonce_field() function is still used. I’ve tested the plugin in WPMU 2.7 and it works.

1.0.2 – March 2, 2009

  • The options page wasn’t working in WordPress MU, so now I’m using add_options_page instead of add_submenu_page to add the options page to the Settings menu.

1.0.1 – March 1, 2009

  • Added a fix to the function that displays the ‘Settings’ link in the WordPress activated plugins list.

1.0 – March 1, 2009

  • First version.

Comments

17 Responses to “WP Hooks”

  1. hi. Thanks for plugin

    perfect.

    Regards

  2. Your plugin is a great idea, but when I attempt to save changes I get the following error:
    “Error! Options page not found.”

    I am running WordPress MU if that makes a difference.

  3. @Tom I added version 1.0.2 to the WordPress Plugin Directory. Try upgrading to that version to see if it works on WPMU now.

  4. Thanks for the really fast reply. I installed 1.0.2 on my server, but I get the same error. Could my permissions cause this?

  5. @Tom I’ve tested WP Hooks 1.0.3 on WPMU 2.7 and it works. If you have an older version of WPMU let me know and I’ll see what I need to do to make it work for that version.

  6. I have 2.7 installed, but may have my permissions on some of my folders wrong. Everything else on my system works and this is my third MU set up, but I have have to adjust folder permissions for other plugins, so I suspect it is that.

  7. It’s a great idea. One thing missing though: PHP execution. I cannot use it whenever I have custom PHP in my header/foother (e.g. I don’t want Sitemeter script to count admin visits, so I enclose it with )

    If you can support this, the next step is to expand the functionality to other hooks besides the header/footer? For example, it would be nice to be able to override “the_posts()” or the_content (don’t remember if that’s the right one) without having to modify the theme.

    It’s a great idea anyway. Thanks.

  8. Nice plugin idea – I am looking for an extended version with many more hooks.

    Have you heard of such a thing for wordpress general ?

    There are some great hooks plugins for a couple of specific themes: K2 ( http://wordpress.org/extend/plugins/k2-hook-up/ ) and Thesis ( http://wordpress.org/extend/plugins/thesis-openhook/ )

  9. Would be great to be able to add some php code.

  10. is hooks working with Thesis 1.5.1? Because I installed and activated it, but nothing is showing up in my menus that says “hooks.”

  11. Does Thesis style the WordPress Admin area different than the default? Since Thesis is a paid theme I can’t download it and see what’s going on.

  12. For the Thesis theme this is the way to go:
    http://wordpress.org/extend/plugins/thesis-openhook/

  13. Hello sir,

    I need a plugin for add Javascript in Userside Post display part. I need some javascript functions to create some popup. So pls give an idea how to include javascript on Userside post page without Edit theme page or any other page only using some plugin functionality.

    Thanks
    Bye Anes

  14. thanks sir, it works for me…so simple and efficient

  15. Hello,
    We are running wordpress-MU 2.6 and wanted to add jsMath, which requires your WP-hooks. I did the install, that is, of jsMath, and put WP-hooks in the plugins directory, then went to the site on wordpress-MU where we wanted it, pushed the ‘activate’ button and everything went blank. And now when you login, the wp-admin page is blank. The other sites in our wordpress-MU admins work fine, just the one where I pushed the activate button. So, some fatal error is occurring causing php to stop. Is it because our wordpress is old? Is because it is the MU version?
    Thanks,

  16. Hello,
    Using WordPress-MU 2.6, I get the following PHP Fatal error:

    Call to undefined function register_setting() in /var/www/html/wordpress-mu-2.6/wp-content/plugins/wp-hooks/wp-hooks.php on line 119

    which kills the admin page.

    Can this be fixed?
    thanks

  17. Hi,

    I’m trying to use your plugin with WPML language plugin, and can’t seem to get the text to translate properly… please help if you can!

    http://wpml.org/faq/getting-string-translation-to-work/

    thanks.

Leave a Reply