Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Is it possible to use wp_list_categories( $args ) several times on a page to list different groups of terms from a taxonomy?

The following code displays on term#58 together with a child that says "No Categories". None of the child terms appear on the page. However, if I remove the first use of the tag wp_list_categories( $args ) then the second group appears on the page and lists the children.

I'd appreciate any suggestions on how to overcome this and get both groups to display. Note that the reason I'm approaching the dispay in this manner is that I want to put the terms into a jquery accordion and so I need to separate out the parent term from the children.

<?php
//set up the header title for the first group
$taxonomy     = 'glossary';
$include      = 58;
$title        = '';


$argstitle1 = array(
    'taxonomy'     => $taxonomy,
    'title_li'     => $title,
    'include'   =>$include
);

wp_list_categories( $argstitle1 );

// list terms in a given taxonomy using wp_list_categories.
// Specifies the list to view by using the "child-of" arguments.

$taxonomy     = 'glossary';
$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        = '';
$Child_of     = 58;


$args = array(
    'taxonomy'     => $taxonomy,
    'orderby'      => $orderby,
    'show_count'   => $show_count,
    'pad_counts'   => $pad_counts,
    'include'        => $include,
    'title_li'     => $title,
    'child_of'   => $Child_of
);
?>

<ul>
    <?php wp_list_categories( $args ); ?>
</ul>
share|improve this question

1 Answer 1

up vote 0 down vote accepted

In the second set of args, you set both include and child_of to 58, which effectively eliminates any possible return.

share|improve this answer
    
Thanks. I assumed because there was no "$include" that the 'include' argument would be excluded. With 'include' removed everything worked as expected. –  dorich Jun 20 '12 at 17:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.