Theme Customization API won’t display value on page

I am trying to build customization page for my wordpress theme. my functions.php file looks like this and working perfect :

function pu_theme_menu()
{
    add_theme_page( 'My Theme Option', 'My Theme Options', 'manage_options', 'pu_theme_options.php', 'pu_theme_page');  
}
add_action('admin_menu', 'pu_theme_menu');


function pu_theme_page()
{
?>
<div class="section panel">
    <h1>Custom Theme Options</h1>
    <form method="post" enctype="multipart/form-data" action="options.php">
        <?php 
    settings_fields('pu_theme_options'); 

    do_settings_sections('pu_theme_options.php');
        ?>
        <p class="submit">
            <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
        </p>

    </form>

     </div>
<?php
}


add_action( 'admin_init', 'pu_register_settings' );


function pu_register_settings()
{
    register_setting( 'pu_theme_options', 'pu_theme_options');    

    add_settings_section( 'header_section', 'HEADER', 'pu_display_setting', 'pu_theme_options.php' );

    $field_args = array(
      'type'      => 'text',
      'id'        => 'pu_textbox',
      'name'      => 'pu_textbox',
      'desc'      => 'Example of textbox description',
      'std'       => '',
      'label_for' => 'pu_textbox',
      'class'     => 'css_class'
    );

    add_settings_field( 'example_textbox', 'Current Logo Text', 'pu_display_setting', 'pu_theme_options.php', 'header_section', $field_args );


}


function pu_display_setting($args)
{
    extract( $args );

    $option_name = 'pu_theme_options';

    $options = get_option( $option_name );


    switch ( $type ) {  
        case 'text':  
            $options[$id] = stripslashes($options[$id]);  
            $options[$id] = esc_attr( $options[$id]);  
            echo "<input class='regular-text$class' type='text' id='$id' name='" . $option_name . "[$id]' value='$options[$id]' />";  
            echo ($desc != '') ? "<br /><span class='description'>$desc</span>" : "";  
            break;  
    }
}

but the new value It’s not displaying in my header.php

Read More
 <div class="col-lg-6 col-md-6 hidden-sm hidden-xs" id="myid">
         <?php echo $options['pu_textbox']; ?>
  </div>

what am I missing, Can anybody help?

Related posts