Joomla & WordPress Tutorials, Info, Discussion, Tips | GavickPro Blog

An Introduction to WordPress Hooks

Hooks are a great way to easily modify the theme code without changing the actual source code. In this article we present a few useful hooks available to you in the GavernWP Framework.

We’ve placed three (3) types of hooks in the GavernWP Framework:

The full list of these hooks is available here.

It is very simple to use these hooks. Simply create your own function and then set it as a second parameter in the add_action function:

add_action('HOOK_NAME', 'YOUR_FUNCTION_NAME');

We recommend placing all hooks in the gavern/hooks.php file.

Take a look at some of the interesing hooks:

GavernWP supports around 30 hooks and this number will increase (especially with version 1.7).

What’s more, you can also add your own hook to the theme’s source code. The creation of new hooks is really simple – use simple code similar to the following:

do_action('YOUR_NEW_HOOK_NAME');

That’s all! This code creates a new hook which can be used in your code and will be executed with the do_action function.

Feel free to test this tip with our free WordPress Theme – Meet GavernWP.

An Introduction to WordPress Hooks 5.005 (100.00%) 1 vote
Share