2013-11-26 3 views
4

제품 용 맞춤 메타 상자를 만들었습니다. 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에서 인쇄 할 수 있습니까?

답변

7

당신은 다음을 수행합니다 :

echo get_post_meta(get_the_ID(), 'orario', true); 
echo get_post_meta(get_the_ID(), 'luogo_evento', true); 
echo get_post_meta(get_the_ID(), 'indirizzo', true ); 
echo get_post_meta(get_the_ID(), 'zona', true ); 
echo get_post_meta(get_the_ID(), 'contatti', true ); 

난이 도움이되기를 바랍니다!

+0

간편하게 .. 감사합니다! – dan

+0

문제 없으니 기꺼이 도와 드리겠습니다 :) – danyo