How to Create Hooks in WordPress

The problem with making changes in WordPress is that you need to make them to the core files.  What a pain in the butt, right?  Well let me tell you about the beauty of using hooks to customize your WordPress theme.  A hook in WordPress gives you a way to write over some of the core functionality of WordPress in order to edit a WordPress theme so that you can make changes but you don’t necessarily need to make them to the core files.

So what is a hook anyways?

These hooks can be written in the functions.php file in the wp-content/themes/yourtheme directory for those of you developers looking to code.  Normally what a hook does is it “hooks” a standard function to some custom functionality in order to “overwrite” the standard functionality without the need to modify code.  Pretty cool eh?  So what does a simple hook look like?  Have a look below at an example…

add_action ( ‘publish_post’,’superCoolFunction’)

As you can see the standard function of ‘publish-post‘ which means that when the ‘publish-post‘ is executed that is hooked to ‘superCoolFunction‘ this function is also executed.  So now that you know the basics of hooks in WordPress let’s talk about some ways that you can use them in your WordPress site using some plugins that have been created to help you implement hooks fast on your website.

A plugin that you can use on any WordPress theme to create hooks

One great plugin that is not theme or theme framework dependent is WP Hooks, a pretty basic and highly powerful way to add hooks into the header and footer areas of your WordPress site.  Have a look at it below in action or feel free to get more information by clicking here.

 

Hook Plugins for Themes and Theme Frameworks

It seems as though the guys behind some of the best themes and theme frameworks have put some thought into creating plugins that do more than just the basics that WP Hooks plugin that I mentioned above.  Here are some great plugins that you might want to consider when purchasing your next theme or theme framework.

Genesis Simple Hooks Plugin


 

The one great thing that this plugin offers is the ability to add a hook in just about anywhere you could possibly want to in a WordPress Theme.  However, this plugin is just for specific use with the Genesis Framework so if you are using this on your WordPress theme currently you’ll be able to use Genesis Framework for free.  Click here to get it!

Thesis OpenHook Plugin

Thesis is another WordPress theme that you can purchase.  This plugin was created so that you could have the functionality of creating hooks without the mess of coding them all by yourself.  Click here to get it!

Hybrid Hook Plugin

This plugin is designed for use with the Hybrid themes.  The Hybrid theme itself is a free WordPress theme with the option to use any number of child themes that have already been developed for it.  It’s definitely worth looking at if you want to use WordPress but don’t want to spend any money on a theme.  Click here to get it and get the Hybrid Hook plugin too!

K2 Hook up Plugin

This plugin can be used with the K2 WordPress theme which is also a free theme.  Much like the Hybrid theme, you can download this theme and use the K2 Hook Up plugin to create your own WordPress hooks.  Click here to get it!

Whether you decide to create your own custom hooks using the functions.php file in WordPress or use one of the plugins I’ve mentioned above, if you learn to master using WordPress hooks you’ll save yourself a lot of headaches and potential problems updating and making changes to your WordPress website.


Get my "Shopify Made Simple" for free

This guide covers the core concepts that you need in order to setup a Shopify ecommerce store for the very first time without any knowledge of coding needed. The guide walks through everything from product creation to selecting a domain name for your Shopify store.

Leave a Reply

Your email address will not be published. Required fields are marked *

WP-SpamFree by Pole Position Marketing