我为产品创建了一些自定义元框。
在 writepanel-product_data.php 我添加了:
woocommerce_wp_text_input( array( 'id' => 'orario', 'class' => '', 'label' => __('Orario', 'woocommerce') ) );
woocommerce_wp_text_input( array( 'id' => 'luogo_evento', 'class' => '', 'label' => __('Luogo Evento', 'woocommerce') ) );
woocommerce_wp_text_input( array( 'id' => 'indirizzo', 'class' => '', 'label' => __('Indirizzo', 'woocommerce') ) );
woocommerce_wp_text_input( array( 'id' => 'zona', 'class' => '', 'label' => __('Zona', 'woocommerce') ) );
woocommerce_wp_text_input( array( 'id' => 'contatti', 'class' => '', 'label' => __('Contatti', 'woocommerce') ) );
然后在第 681 行
update_post_meta( $post_id, 'orario', stripslashes( $_POST['orario'] ) );
update_post_meta( $post_id, 'luogo_evento', stripslashes( $_POST['luogo_evento'] ) );
update_post_meta( $post_id, 'indirizzo', stripslashes( $_POST['indirizzo'] ) );
update_post_meta( $post_id, 'zona', stripslashes( $_POST['zona'] ) );
update_post_meta( $post_id, 'contatti', stripslashes( $_POST['contatti'] ) );
它保存了我在产品页面中插入的数据。我可以在 single-product.php 中打印出来吗?