WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Get the terms - remove hyperlinks for empty terms only (2 posts)

  1. Ali
    Member
    Posted 1 year ago #

    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

  2. Ali
    Member
    Posted 1 year ago #

    Can anyone help with this?

Topic Closed

This topic has been closed to new replies.

About this Topic