From 4dc3ea6edab4552daf646e7b34171b1727ddbd23 Mon Sep 17 00:00:00 2001
From: wzp <2040239371@qq.com>
Date: 星期二, 07 四月 2026 16:42:28 +0800
Subject: [PATCH] fix:增加添越智

---
 添越智/产品详情页简码 |  179 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 179 insertions(+), 0 deletions(-)

diff --git "a/\346\267\273\350\266\212\346\231\272/\344\272\247\345\223\201\350\257\246\346\203\205\351\241\265\347\256\200\347\240\201" "b/\346\267\273\350\266\212\346\231\272/\344\272\247\345\223\201\350\257\246\346\203\205\351\241\265\347\256\200\347\240\201"
new file mode 100644
index 0000000..17dc449
--- /dev/null
+++ "b/\346\267\273\350\266\212\346\231\272/\344\272\247\345\223\201\350\257\246\346\203\205\351\241\265\347\256\200\347\240\201"
@@ -0,0 +1,179 @@
+// 浜у搧瑙勬牸琛ㄦ牸绠�鐮�
+function product_spec_table_shortcode() {
+    $post_id = get_the_ID();
+
+    $tab_top_title        = get_field( 'tab_top_title', $post_id );
+    $table_left_title     = get_field( 'table_left_title', $post_id );
+    $specifications_table = get_field( 'specifications_table', $post_id );
+
+    if ( empty( $specifications_table ) ) {
+        return '';
+    }
+
+    $row_count = count( $specifications_table );
+
+    ob_start();
+    ?>
+    <div class="pst-wrapper">
+        <table class="pst-table" cellspacing="0" cellpadding="0">
+            <colgroup>
+                <col style="width: 90px;">
+                <col style="width: 210px;">
+                <col>
+            </colgroup>
+            <thead>
+                <?php if ( $tab_top_title ) : ?>
+                <tr>
+                    <th class="pst-top-title" colspan="3">
+                        <?php echo esc_html( $tab_top_title ); ?>
+                    </th>
+                </tr>
+                <?php endif; ?>
+            </thead>
+            <tbody>
+                <?php foreach ( $specifications_table as $index => $row ) :
+                    $cell_bg  = '#ffffff';
+                    $key_val  = isset( $row['key'] )   ? esc_html( $row['key'] )   : '';
+                    $val_val  = isset( $row['value'] ) ? esc_html( $row['value'] ) : '';
+                ?>
+                <tr>
+                    <?php if ( $index === 0 ) : ?>
+                    <td
+                        class="pst-left-title"
+                        rowspan="<?php echo esc_attr( $row_count ); ?>"
+                    >
+                        <span><?php echo esc_html( $table_left_title ); ?></span>
+                    </td>
+                    <?php endif; ?>
+                    <td
+                        class="pst-key"
+                        style="background-color: <?php echo esc_attr( $cell_bg ); ?>;"
+                    ><?php echo $key_val; ?></td>
+                    <td
+                        class="pst-value"
+                        style="background-color: <?php echo esc_attr( $cell_bg ); ?>;"
+                    ><?php echo nl2br( $val_val ); ?></td>
+                </tr>
+                <?php endforeach; ?>
+            </tbody>
+        </table>
+    </div>
+
+    <style>
+    .pst-wrapper {
+        width: 100%;
+        overflow-x: auto;
+    }
+
+    .pst-table {
+        width: 100%;
+        border-collapse: collapse;
+        table-layout: fixed;
+        border: 1px solid #e6e6e6;
+    }
+
+    .pst-table .pst-top-title {
+        background-color: #ffffff;
+        color: #333333;
+        text-align: center;
+        font-size: 26px;
+        font-weight: 600;
+        padding: 15px 19px;
+        border-bottom: 1px solid #eeeeee;
+    }
+
+    .pst-table .pst-left-title {
+        background-color: #ffffff;
+        color: #333333;
+        text-align: center;
+        vertical-align: middle;
+        border-right: 1px solid #e6e6e6;
+        border-bottom: 1px solid #eeeeee;
+        padding: 0;
+    }
+
+    .pst-table .pst-left-title span {
+        display: block;
+        font-size: 20px;
+        line-height: 1.5;
+        writing-mode: vertical-rl;
+        text-orientation: mixed;
+        transform: rotate(180deg);
+        white-space: nowrap;
+        margin: auto;
+    }
+
+    .pst-table .pst-key {
+        font-size: 15px;
+        color: #333333;
+        padding: 19px;
+        vertical-align: middle;
+        word-break: break-word;
+        white-space: pre-wrap;
+        border-right: 1px solid #e6e6e6;
+        border-bottom: 1px solid #eeeeee;
+    }
+
+    .pst-table .pst-value {
+        font-size: 15px;
+        color: #333333;
+        padding: 19px;
+        vertical-align: middle;
+        word-break: break-word;
+        white-space: pre-wrap;
+        border-bottom: 1px solid #eeeeee;
+    }
+
+    .pst-table tr:last-child .pst-key,
+    .pst-table tr:last-child .pst-value {
+        border-bottom: none;
+    }
+
+    @media (max-width: 768px) {
+        .pst-table {
+            min-width: 600px;
+        }
+
+        .pst-table .pst-top-title {
+            font-size: 20px;
+            padding: 12px 14px;
+        }
+
+        .pst-table .pst-left-title span {
+            font-size: 16px;
+            line-height: 1.4;
+        }
+
+        .pst-table .pst-key,
+        .pst-table .pst-value {
+            font-size: 14px;
+            padding: 12px;
+            line-height: 1.6;
+        }
+    }
+
+    @media (max-width: 480px) {
+        .pst-table {
+            min-width: 520px;
+        }
+
+        .pst-table .pst-top-title {
+            font-size: 18px;
+            padding: 10px 12px;
+        }
+
+        .pst-table .pst-left-title span {
+            font-size: 14px;
+        }
+
+        .pst-table .pst-key,
+        .pst-table .pst-value {
+            font-size: 13px;
+            padding: 10px;
+        }
+    }
+    </style>
+    <?php
+    return ob_get_clean();
+}
+add_shortcode( 'product_spec_table', 'product_spec_table_shortcode' );
\ No newline at end of file

--
Gitblit v1.9.1