Support » Themes and Templates » How To Display Specific Terms

  • Resolved dorich


    This may be a syntax problem but if so I can’t see the problem.

    I want to select specific terms of a custom taxonomy and display their names. I’m having a problem with the selection process in the following code.

    $taxonomy = ‘chapters’;
    echo(“Test Term Display “);
    ‘include’=> array(74,76
    $chaptertitles=get_terms( ‘chapters’, $args1 );
    $count1 = count($chaptertitles);
    if ( $count1 > 0 ){
    echo ”

      foreach ( $chaptertitles as $chaptertitle ) {
      echo ”

    • Chapter Title:” . $chaptertitle->name . “
    • “;

    echo “
    This returns zero for $count1.

    However, if I remove the arguements so that the default conditions apply then I get all the terms returned.

    This suggests that my syntax is incorrect for $args1 but I can’t see any errors.

    I’d appreciate any suggestions on how to get this working.


Viewing 1 replies (of 1 total)
  • The solution to the problem is that by default terms having no posts are not displayed. This can be changed by adding “hide_empty”=>0 to the parameter list.

Viewing 1 replies (of 1 total)
  • The topic ‘How To Display Specific Terms’ is closed to new replies.