2011-09-23 1 views
1

'외과 의사'를위한 사용자 정의 게시 유형을 추가하려고합니다. 불행히도 6 개의 섹션을 추가해야하는데, 리치 텍스트 여야하고 일반 텍스트가 아닌 이미지 등을 추가해야합니다. 현재 내가 갖고있는 부분입니다.대시 보드의 사용자 지정 게시 유형에 서식있는 텍스트 상자를 추가하려면 어떻게합니까?

나는 모든 일반 텍스트 필드가 잘 작동하지만 이제는 모든 리치 텍스트를 추가해야합니다.

function personal_meta() { 
    global $post; 
    $custom = get_post_custom($post->ID); 

    $email = $custom["email"][0]; 
    $phone = $custom["phone"][0]; 
    $address = $custom["address"][0]; 
    $website = $custom["website"][0]; 
    ?> 

    <p><label>Email:</label><br /> 
    <input type="text" name="email" value="<?php echo $email; ?>" /></p> 

    <p><label>Phone - with extension. i.e. (805) 555-2323 Ext 234</label><br /> 
    <input type="text" name="phone" value="<?php echo $phone; ?>" /></p> 

    <p><label>Address:</label><br /> 
    <textarea cols="50" rows="4" name="address"><?php echo $address; ?></textarea></p> 

    <p><label>Website - BEGINNING WITH http://</label><br /> 
    <input type="text" name="website" value="<?php echo $website; ?>" /></p> 

    <?php 
} 

이를 heres 코드를 저장하는 백엔드 다양한 구조를 설정

ADD_ACTION ('save_post', 'save_details'); <p><br> 태그 (되지 않은 다른 사람을) 빼내야하지만

<textarea class="theEditor" cols="50" rows="4" name="address"> 
    <?php echo $address; ?> 
</textarea> 

:

function save_details(){ 
    global $post; 
    update_post_meta($post->ID, "email", $_POST["email"]); 
    update_post_meta($post->ID, "phone", $_POST["phone"]); 
    update_post_meta($post->ID, "address", $_POST["address"]); 
    update_post_meta($post->ID, "website", $_POST["website"]); 
} 

답변

0

당신은 다음 textarea에 TinyMCE에 편집기를 추가하는 클래스 "theEditor"를 추가해야 저장되었습니다. , 워드 프레스는 메타 값을 소독하라고 sanitize_meta 기능을 사용

<textarea class="theEditor" cols="50" rows="4" name="address"> 
    <?php echo wpautop(get_post_meta($post->ID, 'your text area', true)); ?> 
</textarea> 
0

난 당신이 update_metadata에로, 깊은 일을 할 수 있다고 생각 : 해당 태그를 제거 방지하기 위해

, 당신은 이런 식으로 뭔가를 시도해야합니다 따라서 평범한 가치를 얻을 수 있습니다.

+0

3 년 후 ...... 감사합니다. – Tallboy

관련 문제