wordpress custom taxonomy parent link show static content how?

I am new to wordpress. I have created custom post type attach to a custom taxonomy its working fine and also created custom taxonomy template like
taxonomy-medispa.php(Taxonomy – medispa).

In this template left hand side list the child terms of taxonomy(medispa) associate with links. on the right hand side some static contents regd (taxonomy: medispa).

Read More

Now the condition is once i click the taxonomy term link from left side list the corresponding post to the term link, otherwise it show the static content.

Currently when click the parent link (medispa) and their term link both list the corresponding post.

I need when click the term link it show the posts, but click the parent taxonomy(medispa) show static content.

<?php 
        //start by fetching the terms for the medispa taxonomy
        $terms = get_terms( 'medispa', array(   
        'orderby'    => 'id',
        'hide_empty' => 0
        ));

        echo '<ul>';

        foreach($terms as $term)
        {
            if($term->parent !=0)
            {
               echo '<a href="'.get_term_link((int)$term->term_id, $term->taxonomy).'"><li>'.$term->name.'</li>
               </a>';
            }
        }
        echo '</ul>';   
?>



    <?php /* The loop */ ?>
    <?php while ( have_posts() ) : the_post(); ?>


    <?php //get_template_part( 'content', get_post_format() ); ?>
    <?php endwhile; ?>

Related posts