我有一个自定义分类设置-下载。在下载中,我有几个子类别。我想列出这些条目的标题,条目标题是指向高级自定义字段(文本类型)的链接。我有一些可以循环并打印子类别名称的东西,但我一直在研究如何在每个子类别中显示条目信息。以下是我目前掌握的情况:
<?php
if ( have_posts() ) : ?>
<header class="page-header">
<h1>Subcategories</h1>
</header><!-- .page-header -->
<div class="row">
<div class="col-sm-12">
<?php
/*
* Include the Post-Format-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/
$term = get_queried_object();
$term_id = $term->term_id;
$taxonomy_name = $term->taxonomy;
$termchildren = get_term_children( $term_id, $taxonomy_name );
echo \'<ul>\';
foreach ( $termchildren as $child ) {
$term = get_term_by( \'id\', $child, $taxonomy_name );
echo \'<li><a href="\' . get_term_link( $term, $taxonomy_name ) . \'">\' . $term->name . \'</a></li>\';
}
echo \'</ul>\';
wp_link_pages( array(
\'before\' => \'<div class="page-links">\' . esc_html__( \'Pages:\', \'fernox\' ),
\'after\' => \'</div>\',
) );
the_posts_navigation();
else :
get_template_part( \'template-parts/content\', \'none\' );
endif; ?>
</div>
</div>
</div>
我想我只需要在当前的“foreach”中设置一个循环,但我不知道该怎么做。