'chapters',
'style' => 'none',
'orderby' => 'meta_value_num',
'order' => 'ASC',
'meta_query' => array(
array(
'key' => 'chapter-order',
'type' => 'NUMERIC',
)),
'show_count' => 0,
);
$chapters = get_categories($chapter_args);
foreach ($chapters as $chapter) {
$args = array(
'post_type' => 'comic',
'nopaging' => true,
"tax_query" => array(
array(
'taxonomy' => "chapters", // use the $tax you define at the top of your script
'field' => 'term_id',
'terms' => $chapter->term_id, // use the current term in your foreach loop
),
),
'no_found_rows' => true,
'update_post_meta_cache' => false,
'update_post_term_cache' => false,
);
$chapters_posts = get_posts($args);
if ($chapters_posts) {
echo '' . wp_kses_data($chapter->name) . '
';
echo '';
} // if ($chapters_posts
?>