Trying to understand hooks in reference to this theme

[ad_1]

So index file has this line of code `do_action(‘unblock_blog_home_heading’);` while a template functions file has this line `add_action(‘unblock_blog_home_heading’, ‘unblock_welcome_intro_content’);` and this add\_action is the only place I see this `unblock_blog_home_heading` being defined.

My understanding was that the first argument to add\_action is the name of the hook where you want the callback function to execute. So the names are provided by WordPress such as after\_setup\_theme. But looking at this it seems this first argument can also be used to create hook names on your own? which can then be executed by do\_action?

Is my understanding correct?

[ad_2]
1 Comment
  1. It goes something like this:

    When you see `do_action(‘unblock_blog_home_heading’)` it says, here is a point (hook) where you may insert some content and you will refer to it by the handle `’unblock_blog_home_heading’`.

    The `add_action(‘unblock_blog_home_heading’, ‘unblock_welcome_intro_content’)` says, wherever there is a `’unblock_blog_home_heading’` hook I want to insert the output from the `’unblock_welcome_intro_content’` function.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer