2016-12-12 8 views
0

OptionTree 페이지를 추가하는 것은 아래 코드에서 간단하지만 저장된 데이터를 검색하는 방법을 아는 사람이 있습니까?추가 OptionTree 페이지에서 데이터 가져 오기

/** 

* 관리자 페이지 */ ADD_ACTION ('초기화하기', '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

이는 저장된 데이터를 검색하는 방법은 다음과 같습니다 ('custom_options')를

$ my_plugin_options = get_option을;

echo $ my_plugin_options [ 'test_section_input'];

관련 문제