Adding Sidebar & Featured Posts Below A Post

by Melvin Ram

By request, here’s how you add a sidebar below blog posts & pages. For today, we’ll be inserting teasers of featured posts but you could easily use it to insert adsense code or something else.

Add this code to custom_functions.php

register_sidebars(1,
 array(
 'name' => 'Below Post',
 'before_widget' => '<li id="%1$s">',
 'after_widget' => '</li>',
 'before_title' => '<h3>',
 'after_title' => '</h3>'
 )
);

function add_sidebar_below_post_area(){
 if (is_single()){
 echo "<div class='below_post_teasers'>";
 !dynamic_sidebar('Below Post');
 echo "</div>";
 }
}

add_action('thesis_hook_after_post_box', 'add_sidebar_below_post_area');

This will add a sidebar below your post/page. Now install my Thesis Sidebar Teasers plugin and insert a Thesis Sidebar Teasers widget into the “Below Post” sidebar from the Appearance > Widget page. To get some of the basic styles to look right, add this code to custom.css:

#content .below_post_teasers .teaser {
 width: auto;
 padding: 20px;
 float: none;
}

#content .below_post_teasers li {
 list-style: none;
}

You’ll obviously need to make sure you customize the css to match your needs but this should get you on your way.

Leave a Comment

Spam Protection by WP-SpamFree

Previous post:

Next post: