add_section(
'topbar_options' ,
array(
'title' => __( 'Topbar Options', 'blog-tale' ),
'panel' => 'theme_option_panel',
)
);
/*Enable Top Bar*/
$wp_customize->add_setting(
'theme_options[enable_top_bar]',
array(
'default' => $default_options['enable_top_bar'],
'sanitize_callback' => 'blog_tale_sanitize_checkbox',
)
);
$wp_customize->add_control(
'theme_options[enable_top_bar]',
array(
'label' => __( 'Enable Top Bar', 'blog-tale' ),
'section' => 'topbar_options',
'type' => 'checkbox',
)
);
/*Enable Todays Date*/
$wp_customize->add_setting(
'theme_options[enable_todays_dates]',
array(
'default' => $default_options['enable_todays_dates'],
'sanitize_callback' => 'blog_tale_sanitize_checkbox',
)
);
$wp_customize->add_control(
'theme_options[enable_todays_dates]',
array(
'label' => __( 'Enable Todays Date', 'blog-tale' ),
'section' => 'topbar_options',
'type' => 'checkbox',
'active_callback' => 'blog_tale_is_top_bar_enabled'
)
);
/*Todays Date Format*/
$wp_customize->add_setting(
'theme_options[todays_date_format]',
array(
'default' => $default_options['todays_date_format'],
'sanitize_callback' => 'sanitize_text_field',
)
);
$wp_customize->add_control(
'theme_options[todays_date_format]',
array(
'label' => __( 'Todays Date Format', 'blog-tale' ),
'description' => sprintf( wp_kses( __( 'Date and Time Formatting Documentation.', 'blog-tale' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( 'https://wordpress.org/support/article/formatting-date-and-time' ) ),
'section' => 'topbar_options',
'type' => 'text',
'active_callback' => function( $control ) {
return (
blog_tale_is_top_bar_enabled( $control )
&&
blog_tale_is_todays_date_enabled( $control )
);
}
)
);
/*Enable Social Nav*/
$wp_customize->add_setting(
'theme_options[enable_top_bar_social_nav]',
array(
'default' => $default_options['enable_top_bar_social_nav'],
'sanitize_callback' => 'blog_tale_sanitize_checkbox',
)
);
$wp_customize->add_control(
'theme_options[enable_top_bar_social_nav]',
array(
'label' => __( 'Enable Top Bar Social Nav Menu', 'blog-tale' ),
'description' => sprintf( __( 'You can add/edit social nav menu from here.', 'blog-tale' ), "javascript:wp.customize.control( 'nav_menu_locations[social-menu]' ).focus();" ),
'section' => 'topbar_options',
'type' => 'checkbox',
'active_callback' => 'blog_tale_is_top_bar_enabled'
)
);