vafour/vafpress-framework

Theme options are not saving defaults in database.

Opened this issue · 0 comments

Hi, I have faced a new problem. Just realize that the default values are not saved in database at the very fast time. Once I click save button, then the default options are saved. Here is how I'm registering the options panel:

    add_action( 'init', 'init_my_options' );

    if ( ! function_exists( 'init_my_options' ) ) {
        function init_my_options() {

            $admin_template  =  get_template_directory() . '/admin/option.php';
            // Initialize the Option's object

            $menu_pos = array(
                            'icon_url' => 'dashicons-settings',
                            'position' => 61,
                        );

            $theme_options = new VP_Option(array(
                'is_dev_mode'           => false,
                'option_key'            => 'my_options',
                'page_slug'             => 'my_options',
                'template'              => $admin_template,
                'menu_page'             => $menu_pos,
                'use_auto_group_naming' => true,
                'use_exim_menu'         => true,
                'minimum_role'          => 'edit_theme_options',
                'layout'                => 'fixed',
                'page_title'            => __( 'Theme Options', 'textdomain' ),
                'menu_label'            => __( 'Options', 'textdomain' ),
            ));

        }
    }

I have some core features in options panel. So, when I activate the theme in a new database first time, I get errors. The default values are not in database. When I click save from theme options, then the default values get saved in database and my theme starts working.

Am I missing something?

Thanks in advance.