How to remove related post from home page

I am using thesis i am displaying related post using bellow snippet code.My problem is that i dont want load related post on home page.with the css trick we can make it display none but it loads so i dont want load related post on home page.

i tried this condition if ( is_home() ) and is_front_page() to load function for specific page but its load the related post on home page.

can any body tell how do i prevent this hook to unload related post on home page witout css trick.

function my_related_posts() {

 $orig_post = $post;
global $post;
$tags = wp_get_post_tags($post-ID);
if ($tags) {
$tag_ids = array();
foreach($tags as $individual_tag) $tag_ids[] = $individual_tag-term_id;
$args=array(
'tag__in' = $tag_ids,
'post__not_in' = array($post-ID),
'posts_per_page'=12, // Number of related posts that will be shown.
'caller_get_posts'=1
);
$my_query = new wp_query( $args );
if( $my_query-have_posts() ) {

echo 'div id="related_posts"h3 class="heading033"Read More/h3ul';

while( $my_query-have_posts() ) {
$my_query-the_post(); ?

lidiv class="relatedthumb"a href="? the_permalink()?" rel="bookmark" title="?php the_title(); ?" ?php echo the_post_thumbnail('medium') ?/a/div
div class="relatedcontent"
h3a href="? the_permalink()?" rel="bookmark" title="?php the_title(); ?"?php the_title(); ?/a/h3

/div
/li
? }
echo '/ul/div';
}
}
$post = $orig_post;
wp_reset_query();

}
add_action('thesis_hook_after_post','my_related_posts');

Topic theme-thesis homepage hooks posts Wordpress

Category Web


Simply

if(!is_home() && !is_front_page()) add_action( 'thesis_hook_after_post', 'my_related_posts' );

will do that for you. It will not do the add_action() when we are at the home page or not any front page.

If it doesn't work for you, may be you need to contact with the Thesis team.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.