[resolved] Get Category Children (3 posts)

  1. Chris Da Sie
    Posted 3 years ago #

    How to do I get the children of this category to be listed in the unordered list I have below?

    <?php $categories = get_categories('orderby=name&depth=1&title_li=&use_desc_for_title=1&child_of='); foreach ($categories as $cat) { ?>
    			<dt><a href="#"<?php if ($cat->slug == 'photos') {?> class="customer-acquisitiontop" <?php } else {?>class="customer-acquisitiontop" <?php }?>id="<?php echo $cat->slug; ?>" data-filter=".<?php echo $cat->slug; ?>"><h2><?= $cat->cat_name; ?></h2></a></dt>
    			<dd class="services">
    				<ul class="row">
    					<li class="<?php echo $cat->slug; ?>">
    			<?php } ?>
  2. Michael
    Forum Moderator
    Posted 3 years ago #

  3. Lisa
    Posted 2 years ago #

    And if you want to include all categories even where no posts were applied, add this to the arguments hide_empty=0&
    Am attempting similar thing in custom template but using jQuery accordion see: http://wordpress.org/support/topic/jquery-accordion-using-categories-and-child-cat-titles?

Topic Closed

This topic has been closed to new replies.

About this Topic