Views BEF checkbox count in drupal 7 I have created views with BEF check boxes as a filter criteria. 

I want to get count of each check boxes as mentioned in below image.



Reference link.

My view name is photo_search. So I have renamed below tpl to views-exposed-form--photo-search.tpl


  I have copied views-exposed-form.tpl from views/theme to
  mytheme/templates
  . But its not working (Cache cleared &amp; Rescanned tpl from views).
First of all make alter in your view and place the code.

// Set an index if there are multiple terms used.

    $index = 0;
    // Used for the array's string index.
    $string_index = '';
    // Continue for each vocabulary that is used.
    while (isset($form['tid' . $string_index])) {
        // Cycle through each of the terms.
        foreach ($form['tid' . $string_index]['#options'] as $tid =&gt; $option) {
            // Build a query to get the nodes for this term that have been
            // specified as filters.
            $query = db_select('node', 'n')
                    -&gt;fields('n', array('title'))
                    -&gt;condition('n.type', $form_state['view']-&gt;display_handler-&gt;handlers['filter']['type']-&gt;value, 'IN')
                    -&gt;condition('fa.field_advertisements_value', 'forsale', '=')
                    -&gt;condition('ti.tid', $tid, '=');
            // A quirk in db_select(). You need to add the join separately.
            $query-&gt;innerJoin('taxonomy_index', 'ti', 'ti.nid = n.nid');
            $query-&gt;innerJoin('field_data_field_advertisements', 'fa', 'fa.entity_id = n.nid');
            $results = $query-&gt;execute();
            $count = $results-&gt;rowCount();


// get the count of nodes or watever with your costom query 

            $val = $form['tid' . $string_index]['#options'][$tid];
            $form['tid' . $string_index]['#options'][$tid] = str_replace("&lt;span&gt;(" . $count . ")&lt;/span&gt;&lt;span&gt;(" . $count . ")&lt;/span&gt;", "&lt;span&gt;(" . $count . ")&lt;/span&gt;", $val . '&lt;span&gt;(' . $count . ')&lt;/span&gt;');
        }
        // Increment for the next tid index in the array.
        $index += 1;
        $string_index = '-' . $index;
        //$string_index = '_' . $index;