I want to show taxonomy name in post. I use foreach loop but it does not show any thing to me.

here is my code.

<?php
    global $post;
        $foo_home_url = site_url();
        $url = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
        if(strpos($url, 'foo_cat')){
            $foo_bc_cat = get_the_terms( $post->ID , FOO_POST_TAXONOMY );
    ?>
            <ul>
                <li><a href="<?php echo $foo_home_url; ?>">Home</a></li>
    <?php
                    foreach($foo_bc_cat as $foo_tax_cat){
    ?>
                    <li><a href="<?php echo get_term_link($foo_tax_cat->slug, FOO_POST_TAXONOMY) ?>"><?php echo $foo_tax_cat->name ?></a></li>
    <?php
                    }
    ?>
            </ul>
    <?php
        }
    ?>

Any idea.

Read more here: get_the_terms issue on foreach loop


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , ,

Wordpress related questions and answers: