$x > 0); $count = max(1, min(20, (int) ($cfg['count'] ?? 8))); $layout = (string) ($cfg['layout'] ?? 'grid-cms'); $title = (string) ($cfg['title'] ?? ''); if (!in_array($layout, ['card', 'list', 'masonry', 'grid-cms'], true)) { $layout = 'grid-cms'; } if (empty($cat_ids)) { // 没有指定 → 取站点最热的两个分类 $top_cats = get_terms([ 'taxonomy' => 'category', 'orderby' => 'count', 'order' => 'DESC', 'number' => 4, 'hide_empty' => true, 'fields' => 'ids', ]); if (is_wp_error($top_cats)) $top_cats = []; $cat_ids = array_map('intval', $top_cats); } if (empty($cat_ids)) return; $tabs = []; foreach ($cat_ids as $cid) { $term = get_term($cid, 'category'); if (!$term || is_wp_error($term)) continue; $tabs[] = [ 'id' => $cid, 'name' => $term->name, 'link' => get_category_link($cid), ]; } if (empty($tabs)) return; $active_id = $tabs[0]['id']; ?>

$t) : $tab_post_types = function_exists('aksrt_resource_post_types') ? array_unique(array_merge(['post'], aksrt_resource_post_types())) : ['post']; $query = new WP_Query([ 'cat' => $t['id'], 'post_type' => $tab_post_types, 'posts_per_page' => $count, 'post_status' => 'publish', 'no_found_rows' => true, ]); ?>
> have_posts()) : ?>
have_posts()) { $query->the_post(); get_template_part('templates/parts/content', 'post-card'); } set_query_var('aksrt_post_card_layout', ''); set_query_var('aksrt_post_card_scene', ''); wp_reset_postdata(); ?>