'category', 'hide_empty' => false, 'orderby' => 'term_group', 'order' => 'ASC', ]); if (is_wp_error($all_terms)) { $all_terms = []; } $top_level = []; $children_by_parent = []; foreach ($all_terms as $term) { $parent_id = (int) $term->parent; if ($parent_id === 0) { $top_level[] = $term; } else { $children_by_parent[$parent_id][] = $term; } } $total_posts = wp_count_posts('post'); $total_posts = $total_posts && isset($total_posts->publish) ? (int) $total_posts->publish : 0; $page_title = trim((string) get_the_title($post_id)); $page_title = $page_title !== '' ? $page_title : __('分类目录', 'jio'); $has_sidebar = function_exists('jio_archive_has_sidebar') ? jio_archive_has_sidebar() : (function_exists('jio_is_show_sidebar') ? jio_is_show_sidebar() : false); $content_style = sanitize_key((string) get_post_meta($post_id, 'page_content_style', true)); if (!in_array($content_style, ['', 'not', 'nobox', 'full'], true)) { $content_style = ''; } $content_style_class = $content_style !== '' ? ' page-content-' . $content_style : ' page-content-default'; $render_children = static function (int $parent_id, array $path) use (&$render_children, $children_by_parent): string { $children = $children_by_parent[$parent_id] ?? []; if ($children === []) { return ''; } $html = ''; return $html; }; get_header(); if (function_exists('jio_archive_open_shell')) { jio_archive_open_shell([ 'main_class' => 'site-main container' . $content_style_class, 'has_sidebar' => $has_sidebar, 'top_fluid' => ['page_top_fluid_' . $post_id, 'cat_top_fluid'], 'page_kind' => 'categories', ]); } ?>
esc_html($page_title), 'desc' => sprintf( /* translators: 1: total category count, 2: total published post count */ esc_html__('共 %1$d 个分类 · 共 %2$d 篇文章', 'jio'), count($all_terms), $total_posts ), ]); if ($content_style !== 'not' && trim((string) get_the_content()) !== '') { echo '
'; the_content(); wp_link_pages([ 'before' => '

', 'after' => '

', ]); echo '
'; } ?>
term_id; $link = get_category_link($term_id); if (is_wp_error($link)) { continue; } $cover = function_exists('jio_widget_term_cover_url') ? jio_widget_term_cover_url($term_id, true) : get_template_directory_uri() . '/assets/img/placeholder.svg'; $description = class_exists('\Jio\Settings\Settings') ? \Jio\Settings\Settings::get_category_recommend_desc($term_id) : (string) $term->description; $description = trim(wp_strip_all_tags((string) $description)); ?>

$has_sidebar, 'bottom_fluid' => ['cat_bottom_fluid', 'page_bottom_fluid_' . $post_id], ]); } get_footer();