WordPress.org

Ready to get started?Download WordPress

Forums

Multiple Category Lists on One Page? (1 post)

  1. dorich
    Member
    Posted 2 years ago #

    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
    				);
    ?>
    <?php wp_list_categories( $argstitle1); ?>
    
    <?php
    				//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>

Topic Closed

This topic has been closed to new replies.

About this Topic