다음 코드에서 테마가 어떻게 구성되었는지 알아 내려고합니다. 맞춤 게시 유형의 상점이 생성되고 있음을 알 수 있습니다. 내가 혼란 스러워요 곳 .. 이해 비트뿐만 아니라 필드로 .... 생성되는 'clpr_store_phone'라고 할 수있을 것 같습니다 WordPress 테마 구성 방법 이해 - 이상한 사용자 정의 게시 필드
register_taxonomy(APP_TAX_STORE,
array('promo_code','sale_offers','in_store','coupon'),
array( 'hierarchical' => true,
'labels' => array(
'name' => __('Stores', 'appthemes'),
'singular_name' => __('Store', 'appthemes'),
'search_items' => __('Search Stores', 'appthemes'),
'all_items' => __('All Stores', 'appthemes'),
'edit_item' => __('Edit Store', 'appthemes'),
'update_item' => __('Update Store', 'appthemes'),
'add_new_item' => __('Add New Store', 'appthemes'),
'add_or_remove_items' => __('Add or remove Stores', 'appthemes'),
'separate_items_with_commas' => __('Separate Stores with commas', 'appthemes'),
'choose_from_most_used' => __('Choose from the most common Stores', 'appthemes'),
'new_item_name' => __('New Store Name', 'appthemes')
),
'show_ui' => true,
'query_var' => true,
'update_count_callback' => '_update_post_term_count',
'rewrite' => array('slug' => $store_tax_base_url, 'with_front' => false, 'hierarchical' => true),
)
);
이
function clpr_edit_stores($tag, $taxonomy) {
$the_store_phone = get_metadata($tag->taxonomy, $tag->term_id, 'clpr_store_phone', true);
?>
<tr class="form-field">
<th scope="row" valign="top"><label for="clpr_phone"><?php _e('Phone Number', 'appthemes'); ?></label></th>
<td><input type="text" name="clpr_store_phone" id="clpr_store_phone" value="<?php echo $the_store_phone; ?>"/><br /></td>
</tr>
<?php
}
add_action('stores_edit_form_fields', 'clpr_edit_stores', 10, 2);
function clpr_save_stores($term_id, $tt_id) {
if (!$term_id) return;
if(isset($_POST['clpr_store_phone']))
update_metadata($_POST['taxonomy'], $term_id, 'clpr_store_phone', $_POST['clpr_store_phone']);
}
add_action('edited_stores', 'clpr_save_stores', 10, 2);
이것은 무엇 여기서 준비 중이 야? 'clpr_store_phone'은 분류 체계 내의 맞춤 입력란입니까?
누군가가 그것에 대해 밝힐 수 있습니까?
덕분에, 나는에 따라 더욱라고 생각 무슨 일이 일어나고 있는지 이해. clpr_store_phone 필드에 값이있는 경우 검색하는 방법은 어떻게됩니까? – fightstarr20
당신은 그냥'get_metadata'를 사용하는 것과 같습니다. – ninnypants
나는이 줄을 update_metadata ($ _ POST [ 'taxonomy'], $ term_id, 'clpr_store_phone', $ _POST [ 'clpr_store_phone'])라고합니다. clpr_store_phone 데이터를 저장하고 있습니다. 이걸 get_metadata 명령으로 바꾸려면 어떻게해야합니까? – fightstarr20