2012-04-30 17 views

答えて

2

どのように設定プラグインによっては、これはオプションとして保存「することができ」、

すなわち:

<?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); 
} 
?> 

これは、ワードプレスのテーブルwp_options内

をオプションを作成します。あなたがそのオプションを参照したいのであれば、単にそれを叫ぶだけです。

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

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

うまくいけば、これは正しい方向にあなたを指します。 を通読している:

// getオプションを使用して http://codex.wordpress.org/Function_Reference/get_option

//更新オプション http://codex.wordpress.org/Function_Reference/update_option

//プラグイン http://codex.wordpress.org/Creating_Tables_with_Plugins

幸運 マーティで別々のテーブルを作成します

関連する問題