WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Get the terms – remove hyperlinks for empty terms only

[Resolved] Get the terms – remove hyperlinks for empty terms only

  • Hey everyone,
    I’m hoping to get help here –
    I am showing a list of custom taxonomy “clients” list but want to remove “hyperlinks” from only those that does not have a post attached to it.

    so “hide_empty => true” will not work in this case. I want to list them all but only link those that have posts attached to them.

    here is my simple code so far –

    $args=array('hide_empty' => false,'hierarchical' => true);
    $terms = get_terms('clients',$args);
    echo '<ul id="column" class="span4">';
    if (!empty($terms)){
    foreach ($terms as $term) {
    echo '
    <li><a>slug, 'clients').'">'.$term->name.'</a></li>
    ';
    }
    }

    thanks so much for your help.
    cheers,
    Ali

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Get the terms – remove hyperlinks for empty terms only’ is closed to new replies.