WordPress.org

Ready to get started?Download WordPress

Forums

Get Category Children (3 posts)

  1. cjdsie
    Member
    Posted 1 year 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; ?>">
    					</li>
    				</ul>
    			</dd>
    			<?php } ?>
  2. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

  3. berelson@hotmail.com
    Member
    Posted 7 months 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