Includes plugin hooks at a specific position in the application.
An array of hooks where the key is the position and the value is an array of hook files to include at that position.
The position where the hooks should be included. This can be one of the following values: 'head', 'body', 'body-close', 'footer'.
Description of Returned Data
The includeHook function is a Userspice function that includes plugin hooks at a specific position in the application. It takes two parameters:
$hooks: An array containing the list of plugin hooks. Each hook is an array containing the following information:
name: The name of the plugin that defines the hook.
file: The file path of the hook file within the plugin. $position: The position of the hook to include. This can be one of the following values:
'pre': The hook will be included before the main content.
'post': The hook will be included after the main content.The function loops through the list of hooks at the specified position and includes the file associated with each hook if the plugin that defines the hook is installed and active.
// Include pre-content hooks
// Output main content
// Include post-content hooks
In this example, the includeHook function is used to include the hooks defined by the my_plugin plugin before and after the main content of the page. The $hooks array contains one hook defined by the my_plugin plugin, which specifies the file hooks/my_hook.php to be included at the specified position.