Action hooks are one of the most defining developer features of WordPress. They are points in the software that you can “hook to” in order to execute your own code. Your Theme Blvd theme is also filled with tons its own custom action hooks. Having most of the framework’s functionality hooked to an action, in one way or another, is crucial in making the theme as extendable for you, as possible.
Concept of Action Hooks
If you’re looking to take your child theme past simply making CSS customizations and dive into PHP, and using your child theme’s functions.php, the concept of action hooks one of the most important things you’ll want to master.
Action hooks are used all throughout WordPress. They allow you to “hook to” them, in order to execute your custom functionality.
And in addition to that, theme and plugin developers can also create their own custom action hooks in their products, for other developers to hook to. This is a very important step theme and plugin developers can take, to make their products more extendable to other developers.
Within the Theme Blvd framework, this is what we’ve done for you. We make extensive use hooks, with just about every piece of functionality we add. This means you can add your own functionality, or remove something the framework is doing, all from your child theme’s functions.php.
What an Action Hook Looks Like
If you browse through WordPress core, you can find the function do_action()
called all over the place. The strings passed in are actions you can hook to, to execute custom code.
do_action('something_cool');
And then browsing files of the theme, you can spot where we’ve added tons of these action hooks, as well.

A Theoretical Example
Ok, so you’re seeing these action hooks and understand how to spot them, but what does it all mean? Let’s setup a theoretical example that doesn’t exist anywhere, but should hopefully illustrate what happens with an action hook.
Let’s say we’re going through the parent theme’s file and we can spot an action hook called themeblvd_something_cool
that looks like this:
<?php /** * @hooked themeblvd_something_cool_default - 10 */ do_action('themeblvd_something_cool'); ?>
So now let’s get to work from our child theme’s functions.php, to start utilizing this action hook.
First of all, does this framework action have anything hooked to it by default? We can see the comment above the action hook tells us that the themeblvd_something_cool_default()
callback function is hooked to it, by default. So, if we want to replace the default functionality, we need to first unhook that default callback function.
/** * Remove default function from themeblvd_something_cool * action hook. */ remove_action('themeblvd_something_cool', 'themeblvd_something_cool_default');
Or, if you’re having trouble figuring out what’s hooked to the action, by default, you can use remove_all_actions()
function to just remove all hooked callback functions.
/** * Remove all callback functions from themeblvd_something_cool * action hook. */ remove_all_actions('themeblvd_something_cool');
remove_all_actions()
might be the easiest way to remove default callbacks.And now we’re ready to hook our own functionality to the action. You do this by utilizing the add_action()
function. You’ll pass in (1) the name of the action hook and (2) the name of your callback function.
/** * My custom functionality, hooked to themeblvd_something_cool. */ function my_something_cool() { // do something... } add_action('themeblvd_something_cool', 'my_something_cool');
With this example in our child theme’s functions.php
, we might now have something that looks like the following.
Conclusion
Now, it’s time to experiment with some real action hooks in your theme! For an outline of the basic actions available in the theme framework markup structure, see the following article: