ap_sub_category_list( int $parent_id )

Description #

Display sub categories list.

Parameters #

  • $parent_id
    int (Required) Parent id.

Source #

File: includes/taxo.php

function ap_sub_category_list( $parent_id ) {
	$categories = get_terms(
		array(
			'taxonomy'   => 'question_category',
			'parent'     => $parent_id,
			'hide_empty' => false,
		)
	);

	if ( $categories ) {
		echo '<ul class="ap-category-subitems ap-ul-inline clearfix">';
		foreach ( $categories as $cat ) {
			echo '<li><a href="' . esc_url( get_category_link( $cat ) ) . '">' . esc_html( $cat->name ) . '<span>(' . (int) $cat->count . ')</span></a></li>';
		}
		echo '</ul>';
	}
}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment