The true power of WordPress is in the custom functions, and Thesis takes this concept to task with hooks. A hook is exactly what it sounds like as it is hooked to a specific area of the page. Using these locations makes it easy to unleash the power of Thesis to do almost anything you want.
A good example of how this works would be customized advertising on your site with the Thesis multimedia box. Let’s say that you would like to show an advertising offer on your home page to draw in sponsors, but need to generate income with Adsense everywhere else. This much logic has to be done with a hook as the Thesis dashboard panels and other themes do not allow for this type of complex coding.
Before the multimedia box is used you should activate it in the Thesis design options panel. Just select “custom code” and click the “big ass save button”, and you're good to go. This is also nice because you can then put custom code into the box on the design options page to override the custom function file when you want to place something special there such as a short term notice to visitors.
The first thing that needs to be done before using hooks is to enable the custom file editor in Thesis. This is accomplished by going into your server and changing the name of custom-sample.php to custom.php. It can be found in wp-content, themes, and then thesis18x.
Now when you go back to WordPress and click on the custom file editor you will actually see the editor instead of a message that asks you to rename the above mentioned file. The default view is the CSS editor, but we are looking for the custom functions file. Simply select it from the drop down and click the edit button.
A list of Thesis hooks can be found within the user guide at DIY Themes, but the one we are using today is “thesis_hook_multimedia_box”. This hook is simply tied to the content within the multimedia box.
Here is what all the code looks like that needs entered into the custom functions file to show how this works:
What we have done is simply add a function that checks to see if the displayed page is the home page. If it is home we are going to show something to potential advertisers and get their attention. All the other pages and posts display a PPC advertisement.
The last step is to add our new function to whichever hook we want by using the “add_action” function. The first parameter is the hook you plan to modify, and the second is which function you are adding to the hook. Adding our function to the hook looks like the following when put together:
This is telling Thesis that we would like to add the function named diff_ads to the multimedia box. That is all there is to customizing Thesis. Find the hook you want to use, build your function, and add it to the hook.
Functions can be removed from hooks as well and then replaced with your own code. You can really do anything you want by becoming an advanced Thesis user.
Keith studied web design at FHSU in Hays, KS as well as electronic engineering in Hutchinson, KS. After working for many years as a maintenance electrician, he has decided to take those troubleshooting skills to the internet. Website : Online Digital Junkie