'py-12', 'normal' => 'py-20', 'spacious' => 'py-32' ]; $columns_map = [ '2' => 'grid-cols-2', '3' => 'grid-cols-2 md:grid-cols-3', '4' => 'grid-cols-2 md:grid-cols-4' ]; $ratio_map = [ 'square' => 'aspect-square', 'landscape' => 'aspect-[4/3]', 'portrait' => 'aspect-[3/4]' ]; $spacing = slbuild_get_field( 'spacing', 'attr' ) ?: 'normal'; $source = slbuild_get_field( 'source', 'attr' ) ?: 'woocommerce'; $columns = slbuild_get_field( 'columns', 'attr' ) ?: '3'; $count = (int) ( slbuild_get_field( 'count', 'attr' ) ?: 6 ); $card_style = slbuild_get_field( 'card_style', 'attr' ) ?: 'overlay'; $image_ratio = slbuild_get_field( 'image_ratio', 'attr' ) ?: 'square'; $show_count = (bool) slbuild_get_field( 'show_count', 'attr' ); $cs = slbuild_get_color_scheme( slbuild_get_field( 'color_scheme', 'attr' ) ?: 'white' ); $pad = $spacing_map[ $spacing ] ?? 'py-20'; $col_cls = $columns_map[ $columns ] ?? 'grid-cols-2 md:grid-cols-3'; $ratio_cls = $ratio_map[ $image_ratio ] ?? 'aspect-square'; $eyebrow = slbuild_get_field( 'eyebrow' ); $headline = slbuild_get_field( 'headline' ); $tag = slbuild_meta( 'heading_level' ) ?: 'h2'; $items = []; if ( 'woocommerce' === $source && class_exists( 'WooCommerce' ) ) { $cats = get_terms( [ 'taxonomy' => 'product_cat', 'hide_empty' => true, 'parent' => 0, 'number' => $count, 'orderby' => 'menu_order', ] ); if ( ! is_wp_error( $cats ) ) { foreach ( $cats as $cat ) { $thumb_id = get_term_meta( $cat->term_id, 'thumbnail_id', true ); $items[] = [ 'name' => $cat->name, 'image' => $thumb_id ? wp_get_attachment_image_url( $thumb_id, 'medium' ) : '', 'url' => get_term_link( $cat ), /* translators: %s: product count */ 'count' => $show_count ? sprintf( _n( '%s product', '%s products', $cat->count, 'slb-section-layout-builder' ), number_format_i18n( $cat->count ) ) : '', ]; } } } else { foreach ( slbuild_get_blocks() as $block ) { SLBUILD_SectionLoader::instance()->set_current_block( $block ); $items[] = [ 'name' => slbuild_get_block_field( 'name' ), 'image' => slbuild_get_block_field( 'image', 'url' ), 'alt' => slbuild_get_block_field( 'image_alt' ), 'url' => slbuild_get_block_field( 'url', 'url' ), 'count' => $show_count ? slbuild_get_block_field( 'count' ) : '', ]; } SLBUILD_SectionLoader::instance()->clear_current_block(); } ?>

< class="text-3xl font-semibold tracking-tight ">>