<?



add_action( 'add_meta_boxes', 'product_summary' );
function product_summary() {
    add_meta_box(
        'product_summary',
        '简介',
        'product_summary_meta_box',
        'product'
    );
}
function product_summary_meta_box($post) {
    // 创建临时隐藏表单，为了安全
    // 获取之前存储的值
    $value = get_post_meta( $post->ID, '_product_summary', true );
    if(empty($value)) $value = '';
    echo '<label for="product_summary"></label>';
	echo '<textarea type="text" id="product_summary" name="product_summary" style="width:90%;height:100px">'. esc_attr( $value ).'</textarea>';
}
add_action( 'save_post', 'product_summary_save_meta_box' );
function product_summary_save_meta_box($post_id){
   
    $product_summary = sanitize_text_field( isset($_POST['product_summary'])?$_POST['product_summary'] :'' );
    update_post_meta( $post_id, '_product_summary', $product_summary );
}




add_action( 'add_meta_boxes', 'product_photo' );
function product_photo() {
    add_meta_box(
        'product_photo',
        '产品相册',
        'product_photo_meta_box',
        'product'
    );
}
function product_photo_meta_box($post) {

	$value = get_post_meta( $post->ID, '_product_photo', true );
	require_once(get_template_directory()."/my/product/product_photo_html.php");

}
add_action( 'save_post', 'product_photo_save_meta_box' );
function product_photo_save_meta_box($post_id){

    $product_photo = sanitize_text_field( isset($_POST['product_photo']) ? $_POST['product_photo'] : '' );
    update_post_meta( $post_id, '_product_photo', $product_photo );
}

<?


add_action( 'add_meta_boxes', 'showroom_summary' );
function showroom_summary() {
    add_meta_box(
        'showroom_summary',
        '样品简介',
        'showroom_summary_meta_box',
        'showroom'
    );
}
function showroom_summary_meta_box($post) {
    // 创建临时隐藏表单，为了安全
    // 获取之前存储的值
    $value = get_post_meta( $post->ID, '_showroom_summary', true );
    if(empty($value)) $value = '';
    echo '<label for="showroom_summary"></label>';
	echo '<textarea type="text" id="showroom_summary" name="showroom_summary" style="width:90%;height:100px">'. esc_attr( $value ).'</textarea>';
}
add_action( 'save_post', 'showroom_summary_save_meta_box' );
function showroom_summary_save_meta_box($post_id){
   
    $showroom_summary = sanitize_text_field( isset($_POST['showroom_summary']) ?$_POST['showroom_summary'] :'' );
    update_post_meta( $post_id, '_showroom_summary', $showroom_summary );
}












add_action( 'admin_init', 'showroom_specdata' );
function showroom_specdata() {
    add_meta_box(
        'showroom_specdata',
        'SPEC DATA',
        'showroom_specdata_meta_box',
        'showroom'
    );
}
function showroom_specdata_meta_box($post) {

	$value = get_post_meta( $post->ID, '_showroom_specdata', true );
    //添加 WYSIWYG 编辑器 
    wp_editor ( 
        htmlspecialchars_decode($value) , 
        '_showroom_specdata', 
        array ( "media_buttons" => true ) 
    );
}
add_action( 'save_post', 'showroom_specdata_save_meta_box' );
function showroom_specdata_save_meta_box($post_id){


    $showroom_specdata = wpautop( isset($_POST['_showroom_specdata'])?$_POST['_showroom_specdata'] : '',true );
    update_post_meta( $post_id, '_showroom_specdata', htmlspecialchars($showroom_specdata) );
}<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://jiayusteel.com/wp-sitemap.xsl" ?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url><loc>https://jiayusteel.com/author/admin/</loc></url></urlset>
