Thesis OpenHook Plugin June 5, 2011Posted by Tournas Dimitrios in Wordpress - 3.
Actually “Hooks” are positions , more specifically , module positions . A WordPress page is created by many different parts ( header , content , footer , sidebar-1 , sidebar-2 , ….. ) .Hooks are basically each section of your theme separated into a single part , as well as ways , to define areas before and after those parts. Your header is controlled by one hook (thesis_hook_header) while you can use other hooks to put any code you choose before (thesis_hook_before_header) or after (thesis_hook_after_header). Every area has a hook and most areas also have hooks that will allow you to place things before or after them. Instead of the PHP code appearing on the actual page, only the call to the hook that says “put what’s in this hook here” does . Hooks define where stuff appears and functions define what stuff appears. By leveraging hooks, you can isolate all of your custom HTML changes to a single file — custom_functions.php.
A golden rule , never change or edit existing hooks or functions. Unless you’re a programmer by trade, you will only risk messing something up by touching them. You never change existing hooks or functions in the core files – you simply add additional functions or replace existing functions with new ones . Thesis will check your custom_functions.php for instructions and cross reference it so to speak with the core files. If you have removed a core hook or added an additional hook in the custom_functions.php file, then it will override the commands in its core files .
The official website makes a good explanation what hooks are .
If you really think that creating functions and assigning them through the custom_function.php to the WordPress application is beyond your limits , don’t gave up . Fortunately for us , there is a GUI — graphical user interface — available , that makes coding with Hooks more pleasant . By installing a WordPress Plugin, Thesis OpenHook , you can take control of Thesis Hooks without stressing!
I assume that the plugin is already installed on you WordPress application and demonstrate by an example how to interfere with one specific part/modul of your webpage . Let’s pretend that we want to append an custom text after each WordPress post .
Just open the Thesis OpenHook GUI interface and locate the Box with the name of ” After Content ” . Now just write in this box your custom text . You can use any HTML or PHP code ( of course your PHP code must be surrounded with the PHP tags ) .
That’s it no coding no headaches🙂
- This website provides a nice graphical representation of all Hooks .
- The official tutorial
- Thesis Hooks Reference List
- Default Hook usage in Thesis
- List of all the Conditional that you can use on WordPress