ap_category_details()
Description #
Get category details.
Source #
File: includes/taxo.php
function ap_category_details() {
$var = get_query_var( 'question_category' );
$category = get_term_by( 'slug', $var, 'question_category' );
echo '<div class="clearfix">';
echo '<h3><a href="' . esc_url( get_category_link( $category ) ) . '">' . esc_html( $category->name ) . '</a></h3>';
echo '<div class="ap-taxo-meta">';
echo '<span class="count">' . (int) $category->count . ' ' . esc_attr__( 'Questions', 'anspress-question-answer' ) . '</span>';
echo '<a class="aicon-rss feed-link" href="' . esc_url( get_term_feed_link( $category->term_id, 'question_category' ) ) . '" title="Subscribe to ' . esc_attr( $category->name ) . '" rel="nofollow"></a>';
echo '</div>';
echo '</div>';
echo '<p class="desc clearfix">' . wp_kses_post( $category->description ) . '</p>';
$child = get_terms(
array(
'taxonomy' => 'question_category',
'parent' => $category->term_id,
'hierarchical' => false,
'hide_empty' => false,
)
);
if ( $child ) :
echo '<ul class="ap-child-list clearfix">';
foreach ( $child as $key => $c ) :
echo '<li><a class="taxo-title" href="' . esc_url( get_category_link( $c ) ) . '">' . esc_html( $c->name ) . '<span>' . (int) $c->count . '</span></a>';
echo '</li>';
endforeach;
echo '</ul>';
endif;
}
Expand full source code Collapse full source code View on GitHub: includes/taxo.php:70
Add your comment