Hook Block

Hi Cwicly Team,

How is the Hook Block used please?

Thank you

Hi there @David,

The hook block is simply an easy way to run an action wherever you place the block.
It accepts one parameter currently:

  • The name of the action you’re hooking to

This is particularly useful for plugins that provide actions like WooCommerce etc…

But you can also create your own actions:

// Your function and custom name
function cwicly_custom_action()
    echo 'This is simply echoing simple text...';

// This is the action that outputs the function above into the Cwicly Hook block.
// The first parameter is the name of the action, which you will use in the Cwicly hook
// The second parameter is the name of the callback function (which is run wherever the block is placed)
add_action('cwicly_hook_action', 'cwicly_custom_action', 999);
1 Like