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.
On one of my projects, the client needed a listing of Related Posts and the Add This link to show up below the post’s content, but before the Comments link (see the image above).
If you use thesis_hook_after_post
, your function appears AFTER the Comments link. So what we need to do is remove the comments link, write a new function that contains Add This, Related Posts, and the Comments link function, and stick that at the end of the post. For the Related Posts, I’m using this plugin.
[php]/* Add This, Related Posts, and Comments */
remove_action(‘thesis_hook_after_post’,’thesis_comments_link’);
function custom_related_posts() {
if(is_single() || is_front_page()): ?>
[your AddThis.com code]
<?php wp_related_posts();
thesis_comments_link();
endif;
}
add_action(‘thesis_hook_after_post’,’custom_related_posts’);[/php]
Michael says
Is there a way to not show on the home page. Causing problems with my skin.
Bill Erickson says
If you don’t want it showing up on the homepage, remove the if(is_front_page()), so it’s just if(is_single())
hooman says
thats exactly what i was looking for. tnx : )
hooman says
just one question,
what if i want have “related postd” only in my single page, not in all of my front page,
i used ” if(is_single()): ?> ” , but it cause some problem in comments …
hooman says
ok this worked!
/* Add This, Related Posts, and Comments */
function custom_related_posts() {
if(is_single()): ?>
<?php wp_related_posts();
endif;
}
add_action('thesis_hook_after_post','custom_related_posts');
shashank chinchli says
awesome code man!