• Resolved WebStyley

    (@webstyley)


    I have created custom taxonomies which are working fine. However I am setting up archive pages for each taxonomy. The problem I am having is I would like only the child taxonomy and existing children of the child taxonomy to display on the archive page. I am using the below code. The problem with this code is it displays all custom taxonomies created.

    <?php
    //list terms in a given taxonomy using wp_list_categories (also useful as a widget if using a PHP Code plugin)
    
    $taxonomy     = 'zip-codes';
    $orderby      = 'name';
    $show_count   = 0;      // 1 for yes, 0 for no
    $pad_counts   = 0;      // 1 for yes, 0 for no
    $hierarchical = 1;      // 1 for yes, 0 for no
    $title        = '';
    
    $args = array(
      'taxonomy'     => $taxonomy,
      'orderby'      => $orderby,
      'show_count'   => $show_count,
      'pad_counts'   => $pad_counts,
      'hierarchical' => $hierarchical,
      'title_li'     => $title
    
    );
    ?>
    
    <ul>
    <?php wp_list_categories( $args ); ?>
    </ul>

    How can I show just the children of the child taxonomy of zip-codes.

    My current hierarchy is as follows.

    Zip Codes
    ->Colorado Zip Codes
    –>80123

    Ideally on the page it will only show the numbered zip codes.

    Thanks in advanced for all of the help!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Anonymous User 9055193

    (@anonymized-9055193)

    I think there’s a “child_in” or “child_of” parameter you can try.

    Thread Starter WebStyley

    (@webstyley)

    Thank you very much. I completely neglected to try that. It worked. I added the parameter and it worked!

    Edit: FYI: I used the ‘child_of’ parameter.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Display terms in custom taxonomy child only’ is closed to new replies.