Taxonomy else if not working my code not working. I'm trying to get custom breadcrumbs if user is different taxonomy vocabulary category page. if elseif's not working, but I don't know why.. 

Example: If I go to taxonomy term page that vocabulary id is 2, breadcrumbs is:

Page 1 > Page 1 > Term name

and vocabulary id 2, breadcrumb looks like this:

Page 2 > Page 2 > Term name 

and if ID is not defined it shows default breadcrumbs ( else ).. 

It shows page 1 and else breadcrumbs but else if statement not working.. 

Is that code correct or what?

 /*
 * Taxonomy term callback page
 */

function taxonomy_taxonomy_term_page($term_id) {
$term = taxonomy_term_load($term_id);
$html = '';
$breadcrumb = array();
$parents = taxonomy_get_parents($term-&gt;tid);
$desired_vocab_1 = 1; // Vocabulary ID
$desired_vocab_2 = 2; // Vocabulary ID
$desired_vocab_3 = 3; // Vocabulary ID

if(count($parents) &gt; 0) {

    $show_sub_cat = false;
    $list = get_legal_articles($term-&gt;tid);
    foreach($parents as $item)
        $_parent = $item;

    $breadcrumb[] = l(t('Default page'), 'Default page');
    $breadcrumb[] = l($_parent-&gt;name, 'taxonomy/term/'.$_parent-&gt;tid);

    $html =  theme('category_details', array('term' =&gt; $term, 'list' =&gt; $list, 'is_sub_cat' =&gt; $show_sub_cat));

 } else {

 if (((arg(0) == 'taxonomy')
 &amp;&amp; (arg(1) == 'term')
 &amp;&amp; is_numeric(arg(2))
 &amp;&amp; ($term = taxonomy_term_load(arg(2)))
 &amp;&amp; ($term-&gt;vid == $desired_vocab_1))) {

$breadcrumb[] = l(t('Page 1'), 'Page 1');

$childs = taxonomy_get_children($term-&gt;tid);

$html = theme('parent_category_details', array('term' =&gt; $term, 'list' =&gt; $childs));


 } elseif (((arg(0) == 'taxonomy') 
  &amp;&amp; (arg(1) == 'term') 
  &amp;&amp; is_numeric(arg(2)) 
  &amp;&amp; ($term = taxonomy_term_load(arg(2))) 
  &amp;&amp; ($term-&gt;vid == $desired_vocab_2))) {

$breadcrumb[] = l(t('Page 2'), 'Page 2');
$breadcrumb[] = l(t('Page 2.1'), 'Page 2.1');

$childs = taxonomy_get_children($term-&gt;tid);

$html = theme('private_category_details', array('term' =&gt; $term, 'list' =&gt; $childs));

} else {

$breadcrumb[] = l(t('Page 3'), 'Page 3');
$breadcrumb[] = l(t('Page 3.1'), 'Page 3.1');

$childs = taxonomy_get_children($term-&gt;tid);

$html = theme('private_category_details', array('term' =&gt; $term, 'list' =&gt; $childs));


}

// Set Breadcrumbs
drupal_set_breadcrumb($breadcrumb);
drupal_set_title($term-&gt;name);

return $html;
}
In your code the html of 'Default page' is never returned. I have refactored it a little bit to make it cleaner and easier to maintain.
    

/*
 * Taxonomy term callback page
 */
function taxonomy_taxonomy_term_page($term_id) {
  $term = taxonomy_term_load($term_id);
  $breadcrumb = array();
  $parents = taxonomy_get_parents($term-&gt;tid);
  // Vocabulary IDs
  $desired_vocab_1 = 1;
  $desired_vocab_2 = 2;
  $desired_vocab_3 = 3;

  if (count($parents) &gt; 0) {
    $show_sub_cat = false;
    $list = get_legal_articles($term-&gt;tid);

    foreach ($parents as $item) {
      $_parent = $item;
    }

    $breadcrumb[] = l(t('Default page'), 'Default page');
    $breadcrumb[] = l($_parent-&gt;name, 'taxonomy/term/' . $_parent-&gt;tid);
    $html = theme('category_details', array('term' =&gt; $term, 'list' =&gt; $list, 'is_sub_cat' =&gt; $show_sub_cat));
  }
  else if (arg(0) == 'taxonomy' &amp;&amp; arg(1) == 'term' &amp;&amp; is_numeric(arg(2))) {
    $term = taxonomy_term_load(arg(2));

    switch ($term-&gt;vid) {
      case $desired_vocab_1:
        $breadcrumb[] = l(t('Page 1'), 'Page 1');
        break;
      case $desired_vocab_2:
        $breadcrumb[] = l(t('Page 2'), 'Page 2');
        $breadcrumb[] = l(t('Page 2.1'), 'Page 2.1');
        break;
      case $desired_vocab_3:
        $breadcrumb[] = l(t('Page 3'), 'Page 3');
        $breadcrumb[] = l(t('Page 3.1'), 'Page 3.1');
        break;
      default:
        $breadcrumb[] = l(t('Default page'), 'Default page');
    }

    $childs = taxonomy_get_children($term-&gt;tid);
    $html = theme('private_category_details', array('term' =&gt; $term, 'list' =&gt; $childs));

    drupal_set_title($term-&gt;name);
  }

  // Set Breadcrumbs
  drupal_set_breadcrumb($breadcrumb);

  return $html;
}