Page 1 of 1

Plugin hooks in theme

Posted: Fri Apr 02, 2021 2:11 pm
by cobber
Have been reading the documentation and would like to know what the hook ''siteHead, 'siteBodyBegin' and 'siteBodyEnd' relate to. The documentation says "contains all the plugins" . . . can someone explain what they mean by 'all the plugins'

Re: Plugin hooks in theme

Posted: Fri Apr 02, 2021 4:41 pm
by Edi
cobber wrote: Fri Apr 02, 2021 2:11 pm Have been reading the documentation and would like to know what the hook ''siteHead, 'siteBodyBegin' and 'siteBodyEnd' relate to.
You can see for example the default theme Alternative:

https://github.com/bludit/bludit/blob/m ... /index.php
The documentation says "contains all the plugins" . . . can someone explain what they mean by 'all the plugins'
Where is this written?

Re: Plugin hooks in theme

Posted: Mon Apr 05, 2021 9:14 am
by cobber
Morning ,

It's located in the page https://docs.bludit.com/en/themes/examp ... cond-theme

Under the heading 'Add plugin support'

Was trying to understand siteHead and what it returns when I include it in a page.
I do see that siteHead returns the following tag:

<link rel="canonical" href="bahbahbahetc" />

Will investigate the following too:

siteBodyBegin and siteBodyEnd


Thanks

Re: Plugin hooks in theme

Posted: Mon Apr 05, 2021 1:23 pm
by lightmat
All plugins have different functionality, so the different plugins are designed to appear in a specific place in the theme. e.g. sitehead, sidebar, footer, etc. This is what hooks are for, to hook into the place in the theme where it should appear.
See the code in various plugins, then you will see a function that tells where the plugin belongs in the theme (hook)
e.g. plugin "canonical" has the function:
public function siteHead(), which specifies that the output should be in the sitehead between the HTML tag <head> </head>, so all plugins with the function siteHead() will have output in that place.