Adding Content Between Posts in Thesis

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;.

Bill Erickson

Bill Erickson is the co-founder and lead developer at CultivateWP, a WordPress agency focusing on high performance sites for web publishers.

About Me
Ready to upgrade your website?

I build custom WordPress websites that look great and are easy to manage.

Let's Talk

Reader Interactions

Comments are closed. Continue the conversation with me on Twitter: @billerickson

Comments

  1. João says

    Hi…

    Can you release the code for the homepage_widgets…
    Maybe a Tutorial.. Please…

    Regards