2012-04-30 2 views

답변

2

어떻게 설정 플러그인을,이

, 옵션으로 저장 '수'에 따라 예 : 이것은 워드 프레스 테이블 wp_options 다음

내 옵션을 생성합니다

<?php 

// Grab our options, IF your using Options 
// if not you can create and use your own tables to store data 
$options = get_option('your_plugin_options'); 

// using a hidden field on the form called action with a value of 'save'  
if(isset($_POST['action']) && ($_POST['action']=='save')){ 

    $options['main_content'] = trim($_POST['content']); 

    $newOptions = array('main_content' => $options['main_content']); 

    update_option('your_plugin_options', $newOptions); 
} 
?> 

, 당신이 그 옵션을 추천하고 싶다면 단순히 그것을 외치십시오.

<?php 
$options = get_option('your_plugin_options'); 
$new_content = $options['main_content']; 

echo $options['main_content']; 
//or 
echo $new_content; 
?> 

희망 사항은 올바른 방향으로 사용자를 안내합니다. 는을 통해 읽고 :

// 가져 오기 옵션을 사용하여 http://codex.wordpress.org/Function_Reference/get_option

// 업데이트 옵션 http://codex.wordpress.org/Function_Reference/update_option

// 플러그인 http://codex.wordpress.org/Creating_Tables_with_Plugins

행운 마티 별도의 테이블을 생성

관련 문제