php - do_settings_sections not working in WordPress admin -


i using wordpress settings api build options page theme. can't input elements display in admin. think i've narrowed problem do_settings_sections(); function thing not rendering on front end.

    function cbc_theme_init() {         register_setting( 'cbcsettings-group', 'carousel_options' );         add_settings_section(             'cbc_carousel_section',             'carousel settings',             'cbc_carousel_section_callback',             'cbcsettings'         );          add_settings_field(             'cbc_slide_one_title',             'title',             'cbc_slide_title_callback',             'cbcsettings',             'cbc_carousel_section'         );      } // end cbc_theme_init      function cbc_carousel_section_callback() {      } // end cbc_carousel_section_callback      function cbc_slide_title_callback() {          $options = get_option( 'carousel_options' );          /*if( !isset( $options[ 'slide_one_title' ] ) ) {             $options[ 'slide_one_title' ] = '';         }*/          $html = '<input type="text" id="cbc_slide_one_title" name="carousel_options[slide_one_title]" value="' . $options[ 'slide_one_title' ] . '" />';         $html .= '<lable for="cbc_slide_one_title">title first slide.</label>';          echo $html;      } // end cbc_slide_title_callback      function cbc_add_theme_page() {          add_theme_page(             __( 'theme options', 'cbcsettings' ),             __( 'theme options', 'cbcsettings' ),             'edit_theme_options',             'cbcsettings',             'cbc_theme_options_page'         );       } // end cbc_add_theme_page      add_action( 'admin_menu', 'cbc_add_theme_page' );       function cbc_theme_options_page() {     ?>          <div class="wrap">             <h2>theme options - <?php echo wp_get_theme(); ?></h2>             <?php get_settings_errors(); ?>              <form method="post" action="options.php">                 <?php                      settings_fields( 'cbcsettings-group' );                     do_settings_sections( 'cbcsettings' );                     submit_button();                  ?>             </form>         </div>     <?php      } // end cbc_theme_options_page 

finally figured out! apparently, forgot initiate code. needed call following function add_filter( 'admin_init', 'cbc_theme_init' );


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -