Can we make template for contextual filter? Can we make template for contextual filter, because while I am writing php code in it, it is not supplying true values.
I am writing these code in php code of contextual filter:

&lt;?php 
   $children = array_keys(taxonomy_get_children($handler-&gt;argument, $vid=1));
   if(!empty($children)) $handler-&gt;argument .= '+' .implode('+', $children); 
?&gt;

I need to apply these code in template file so that get satisfactory result over there and can apply some custom code too.
There is no such template, but to override contextual filters you can follow the following approach:

In a custom module

you can use hook__views_pre_view to change contextual filter,
add children terms till depth to the contextual filter,
function taxonomy_get_children_all() defined below, will fetch all child terms till depth:
In view, don't forget to allow multiple value contextual filter for contextual filter.

function taxonomy_get_children_all($tid, $vid = 0, $key = 'tid'){
  $c = taxonomy_get_children($tid, $vid, $key);
  $result = array();
  foreach ($c as $t =&gt; $d){
    $result[$t] = $d;
    $below = taxonomy_get_children_all($t, $vid, $key);
    if (!empty($below)) {
       foreach ($below as $nt =&gt; $nd){
         $result[$nt] = $nd;
       }
    }
 }
 return $result;
 }


 function formalter_views_pre_view(&amp;$view, &amp;$display_id, &amp;$args){
 if($view-&gt;name == "category_view") { // &amp;&amp; $display_id == "page") {
   $vid = &lt;Your vocabulary id&gt;;

   $t = $args[0];

   $tt = taxonomy_get_children_all($t,$vid);
   foreach($tt as $k =&gt; $v) {
     $a = (string)$k;
     $args[0] = $args[0] . "+" . $a;
   }
 }
}