This post has been marked as old. The code might no longer work. Comments have been disabled as this is no longer maintained. Use the search on the right to find a newer tutorial.
For a recent client project (FutureCrimes.com), they wanted to move the content typically found in a sidebar right in between the Featured posts and the Teasers. Luckily Chris Pearson added thesis_hook_post_box_bottom
in the most recent release of Thesis.
Sticking code between the posts can be used to stick ads in the middle of the site, or anything else. If you want something to show up after certain posts, but not all, then follow this technique.
As a review, there’s three conditions for hooks, with the third one being optional (and needed for this example). It goes:
add_action('hook_name','function_name',position)
On the site in question, we have 1 featured post followed by 10 teasers. So I’m going to use:
add_action('thesis_hook_post_box_bottom','homepage_widgets',1);
I then put all the code I wanted to show up after the first post in the function homepage_widgets()
.
Note that this will stick your function at the end of the first post box on every post, page and post aggregates (search, category, tag…). To limit it to just the homepage, your function should begin with if(is_home()):
and end with endif;
.
João says
Hi…
Can you release the code for the homepage_widgets…
Maybe a Tutorial.. Please…
Regards
Bill Erickson says
Here’s a tutorial on creating new widget areas: https://www.billerickson.net/wordpress-thesis-additional-sidebars/