• I’ve recently purchased the simplecrisp theme on wrapbootstrap.com and implemented it for my portfolio site : https://www.Twanneman.nl

    The site is almost finished but I’ve got a problem listing portfolio subcategories in the footer of the site. I’m using the following code to generate the list, but somehow I can’t get the links to work.

    <?php
    		//List all the portfolio categories in the portfolio category, except the excluded one
    
    echo '<ul class="nav nav-list">';
    		$exclude_cat = get_post_meta($post->ID, 'ydcoza_exclude_cat', true);
    		$terms = get_terms('portfolio_category', 'hide_empty=1');
    		foreach($terms as $term) {
    			if ($term->slug != $exclude_cat){
    				echo '<li><a href="'.get_term_link($term->slug, 'portfolio_category').'"><i class="'.$term->description.' icon-large"></i> '.$term->name.'</a></li>';
    			}
    		}
    echo '</ul>';
    ?>

    Can anyone please give me advice or point me in the right direction ?

    Kind regards, Twan

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Twanneman

    (@twanneman)

    anyone???

    Thread Starter Twanneman

    (@twanneman)

    I’ve fixed it!
    Adding “?post_type=portfolio” to the links made them work ?? See the code below :

    <?php
    		//List all the portfolio categories in the portfolio category, except the excluded one
    
    echo '<ul class="nav nav-list">';
    		$exclude_cat = get_post_meta($post->ID, 'ydcoza_exclude_cat', true);
    		$terms = get_terms('portfolio_category', 'hide_empty=1');
    		foreach($terms as $term) {
    			if ($term->slug != $exclude_cat){
    				echo '<li><a href="'.get_term_link($term->slug, 'portfolio_category').'?post_type=portfolio"><i class="'.$term->description.' icon-large"></i> '.$term->name.'</a></li>';
    			}
    		}
    echo '</ul>';
    
    ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘get_term_link: listing portfolio subcategories’ is closed to new replies.