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.

Adding Content Between Posts in Thesis

future-crimes2

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 is a WordPress Consultant who builds custom websites using WordPress as a CMS and the Genesis framework. He contributes to the WordPress community through free themes, plugins, tutorials, and core patches. He's also a cofounder of the BIL Conference (the open analog to the TED Conference).

Looking for more great tutorials? See them all!

Comments

  1. João says:

    Hi…

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

    Regards

Trackbacks

  1. [...] Tip #18: Full Width Navigation Thesis Tip #17: Adding Content Between Posts Thesis Tip #16: Redirect [...]