I'm using the following code to generate a list of only the child terms within my taxonomy. What I'd also like to do is display a list of the child terms for each parent category on a taxonomy-mytax-myterm.php
template for each parent. I'm trying to manipulate the code below to do this (while excluding the parent still) but I'm not sure how / where to specify the current parent and to grab all the terms under the parent.
Also, curious if it would be possible to achieve pagination using this method on a taxonomy archive like this? I have found ways of achieving pagination via page-template, but learned it would not work on archive-template for CPT. Not sure if this applies to taxonomy archive templates as well?
<?php
$args = array(
'orderby' => 'name',
);
$terms = get_terms( 'mytaxname', $args );
if ( !empty( $terms ) && !is_wp_error( $terms ) ){
foreach ( $terms as $term ) {
if( 0 == $term->parent )
continue;
echo '<a href="' . get_category_link( $term->term_id ) . '">' . $term->name . '</a><br/>';
}
}
?>