• I am having trouble removing/showing terms in two lists from the same taxonomy. I would like to show only certain terms from the a taxonomy in one list and the same for another. I have included the code that shows the lists below, any help is much appreciated!

    <div id="primary">
                <div id="content" role="main">
                <div>
                	<p>
    
                <?php
                     $terms = get_terms("tagportfolio");
                     $count = count($terms);
                     echo '<ul id="portfolio-filter">';
                     if ( $count > 0 ){
    
                            foreach ( $terms as $term ) {
                                $include =
                                $termname = strtolower($term->name);
                                $termname = str_replace(' ', '-', $termname);
                                echo '<li><a href="#'.$termname.'" title="" rel="'.$termname.'">'.$term->name.'</a></li>';
                            }
                     }
                     echo "</ul>";
                ?>
    
                <?php
                     $terms = get_terms("tagportfolio");
                     $count = count($terms);
                     echo '<ul id="portfolio-filter">';
                     if ( $count > 0 ){
    
                            foreach ( $terms as $term ) {
    
                                $termname = strtolower($term->name);
                                $termname = str_replace(' ', '-', $termname);
                                echo '<li><a href="#'.$termname.'" title="" rel="'.$termname.'">'.$term->name.'</a></li>';
                            }
                     }
                     echo "</ul>";
                ?>
Viewing 1 replies (of 1 total)
  • Thread Starter Aaron28

    (@aaron28)

    I have managed to figure out the best way to only show certain terms on the first menu, but I am still puzzled as to how to remove those terms from the second menu. The updated code is below.

    <?php
                     $terms = get_terms("tagportfolio");
                     $count = count($terms);
                     echo '<ul id="portfolio-filter">';
                     echo '<li><a href="#all" title="">All</a></li>';
                     echo '<li><a rel="environmental-planning-and-design" href="#environmental-planning-and-design">Environmental Planning and Design</a></li>';
                     echo '<li><a rel="environmental-technical-assistance-and-justice" href="#environmental-technical-assistance-and-justice">Environmental Technical Assistance and Justice</a></li>';
                     echo '<li><a rel="grant-administration-and-writing" href="#grant-administration-and-writing">Grant Administration and Writing</a></li>';
                     echo '<li><a rel="green-jobs-workforce-and-trade-skills-development" href="#green-jobs-workforce-and-trade-skills-development">Green Jobs Workforce and Trade Skills Development</a></li>';
                     echo "</ul>";
                ?>
    
                <?php
                     $terms = get_terms("tagportfolio");
                     $count = count($terms);
                     echo '<ul id="portfolio-filter">';
                     if ( $count > 0 ){
    
                            foreach ( $terms as $term ) {
    
                                $termname = strtolower($term->name);
                                $termname = str_replace(' ', '-', $termname);
                                echo '<li><a href="#'.$termname.'" title="" rel="'.$termname.'">'.$term->name.'</a></li>';
                            }
                     }
                     echo "</ul>";
                ?>

Viewing 1 replies (of 1 total)
  • The topic ‘removing terms from li’ is closed to new replies.