Support » Fixing WordPress » is_tax() conditional statement in code not working in 2.9.2?

  • Resolved design_dolphin

    (@design_dolphin)


    WordPress version is 2.9.2 (option not available in jump menu at time of writing)

    After upgrade to WordPress 2.9.2 the following piece of code starting from the elseif point returns nothing:

    <div id="br">
    
    <h2 class="accessibility">Breadcrumbs</h2>
    
    <?php $term = get_term_by( 'slug', get_query_var( 'term' ),get_query_var( 'taxonomy' ) ); 
    
    $tax_term_breadcrumb_term_slug =  $term->slug;
    $tax_term_breadcrumb_taxonomy_slug = $term->taxonomy;
    
        foreach (get_the_category() as $cat) {
    		$parent = get_category($cat->category_parent);
    		$parent_name = $parent->cat_name;
    		$parent_slug = $parent->slug;
    	}			
    
    if ( is_category($parent_name)  ) { ?>
    
    <ul class="bri">
    
    <li><span class="br-title">You are here:</span></li>
    <li><a href="<?php echo get_option('home'); ?>/" title="Home">Home</a> »</li>
    <li> <?php echo $parent_name; ?></li>
    
    </ul>
    
    /// Code stops working here and returns blanco result. 
    
    <?php } elseif (is_tax($tax_term_breadcrumb_term_slug)) { ?>
    
    <ul class="bri">
    
    <li><span class="br-title">You are here:</span></li>
    <li><a href="<?php echo get_option('home'); ?>/" title="Home">Home</a> »</li>
    <li><a href="<?php echo get_option('home')?>/<?php echo $parent_slug ?>" title="<?php echo $parent_name; ?>"> <?php echo $parent_name; ?></a> »</li>
    <li><?php echo $term->name; ?></li>
    
    </ul>

    So far the problem piece of code appears to be:

    <?php } elseif (is_tax($tax_term_breadcrumb_term_slug)) { ?>

    Custom taxonomy is working on all other parts of the site. It just appears to be this part. Luckily it is on a testing site.

    Anyone know what is going on or know how to solve it?

Viewing 1 replies (of 1 total)
  • Changing:

    <?php } elseif (is_tax($tax_term_breadcrumb_term_slug)) { ?>

    to:

    <?php } elseif (is_tax()) { ?>

    Solves it. Breadcrumbs are working normally again.

Viewing 1 replies (of 1 total)
  • The topic ‘is_tax() conditional statement in code not working in 2.9.2?’ is closed to new replies.