2016-12-12 4 views
0

OptionTreeページを追加するのは簡単ですが、以下のコードでは簡単ですが、保存されたデータを取得する方法を知っている人はいますか?追加のOptionTreeページからデータを取得する

/** 

*管理ページ */ add_action( 'initの'、 'register_options_pages')を登録してフック。

/** *必要な管理ページをすべて登録します。 */ 関数register_options_pages(){

//(is_admin()& & function_exists( 'ot_register_settings')){

// Register the pages 
ot_register_settings( 
    array(
    array( 
     'id'    => 'custom_options', 
     'pages'   => array(
     array(
      'id'    => 'test_page', 
      'parent_slug'  => 'options-general.php', 
      'page_title'  => 'Test Page', 
      'menu_title'  => 'Test Page', 
      'capability'  => 'edit_theme_options', 
      'menu_slug'  => 'test-page', 
      'icon_url'  => null, 
      'position'  => null, 
      'updated_message' => 'Test Page updated.', 
      'reset_message' => 'Test Page reset.', 
      'button_text'  => 'Save Changes', 
      'show_buttons' => true, 
      'screen_icon'  => 'options-general', 
      'contextual_help' => null, 
      'sections'  => array(
      array(
       'id'   => 'test_section', 
       'title'  => __('Test Section', 'motif-core') 
      ) 
     ), 
      'settings'  => array(
      array(
       'id'   => 'test_section_input', 
       'label'  => 'Test Input', 
       'desc'  => 'Pretty freaking awesome!', 
       'std'   => '', 
       'type'  => 'text', 
       'section'  => 'test_section', 
       'class'  => '' 
      ) 
     ) 
     ) 
    ) 
    ) 
) 
); 

が、私はこれをしようとした場合OTが をインストールされている場合にのみ、管理&に実行$ my_plugin_options = get_option( 'custom_options');フロントエンドに「アレイ」という単語だけが表示されていますか?

答えて

0

これは、格納されたデータ取得方法です:

$ my_plugin_options = get_option( 'custom_options');

echo $ my_plugin_options ['test_section_input'];

関連する問題