__( 'Social Links Menu', 'asmartgs' ),
) );
load_theme_textdomain( 'asmartgs', get_template_directory() . '/languages' );
function asmartgs_get_option_defaults_values() {
global $asmartgs_default_values;
$asmartgs_default_values = array(
'asmartgs_custom_css' => '',
'header_settings' => 0,
'img-upload-header-logo' => '',
'content_layout' => 'right',
);
return apply_filters( 'asmartgs_get_option_defaults_values', $asmartgs_default_values );
}
function asmartgs_customize_register( $wp_customize ) {
$wp_customize->add_panel( 'asmartgs_theme_options', array(
'priority' => 10,
'capability' => 'edit_theme_options',
'title' => __('Asmartgs Options', 'asmartgs')
));
/******************** Header Options ******************************************/
$wp_customize->add_section('custom_header_setting', array(
'title' => __('Header Options', 'asmartgs'),
'priority' => 110,
'panel' =>'asmartgs_theme_options'
));
$wp_customize->add_setting( 'asmartgs_theme_settings[img-upload-header-logo]',array(
'sanitize_callback' => 'esc_url_raw',
'type' => 'option',
'capability' => 'manage_options'
));
$wp_customize->add_control(
new WP_Customize_Image_Control(
$wp_customize,
'img-upload-header-logo',
array(
'label' => __('Header Logo','asmartgs'),
'section' => 'custom_header_setting',
'settings' => 'asmartgs_theme_settings[img-upload-header-logo]'
)
)
);
$wp_customize->add_setting('asmartgs_theme_settings[header_settings]', array(
'default' => 'header_text',
'sanitize_callback' => 'prefix_sanitize_integer',
'type' => 'option',
'capability' => 'manage_options'
));
$wp_customize->add_control('custom_header_display', array(
'label' => __('Display', 'asmartgs'),
'section' => 'custom_header_setting',
'settings' => 'asmartgs_theme_settings[header_settings]',
'type' => 'radio',
'checked' => 'checked',
'choices' => array(
'header_text' => __('Header Text Only','asmartgs'),
'header_logo' => __('Header Logo Only','asmartgs'),
'disable_both' => __('Disable Both','asmartgs'),
),
));
/********************Content Layout ******************************************/
$wp_customize->add_section('asmartgs_content_layout', array(
'title' => __('Content Layout', 'asmartgs'),
'description' => __('Make sure that you have not set the layout from specific page','asmartgs'),
'priority' => 120,
'panel' =>'asmartgs_theme_options'
));
$wp_customize->add_setting('asmartgs_theme_settings[content_layout]', array(
'default' => 'right',
'sanitize_callback' => 'prefix_sanitize_integer',
'type' => 'option',
'capability' => 'manage_options'
));
$wp_customize->add_control('asmartgs_content_layout', array(
'section' => 'asmartgs_content_layout',
'settings' => 'asmartgs_theme_settings[content_layout]',
'type' => 'radio',
'checked' => 'checked',
'choices' => array(
'right' => __('Right Sidebar','asmartgs'),
'left' => __('Left Sidebar','asmartgs'),
'full-width' => __('Full Width, No Sidebar','asmartgs'),
),
));
/********************Custom Css ******************************************/
$wp_customize->add_section( 'asmartgs_custom_css', array(
'title' => __('Custom CSS', 'asmartgs'),
'priority' => 130,
'panel' =>'asmartgs_theme_options'
));
$wp_customize->add_setting( 'asmartgs_theme_options[asmartgs_custom_css]', array(
'default' => '',
'sanitize_callback' => 'asmartgs_sanitize_custom_css',
'type' => 'option',
)
);
$wp_customize->add_control( 'asmartgs_custom_css', array(
'label' => __('Custom CSS','asmartgs'),
'section' => 'asmartgs_custom_css',
'settings' => 'asmartgs_theme_options[asmartgs_custom_css]',
'type' => 'textarea'
)
);
}
add_action( 'customize_register', 'asmartgs_customize_register' );
/********************Sanitize the values ******************************************/
function asmartgs_sanitize_custom_css( $input ) {
if ( $input != '' ) {
$input = str_replace( '<=', '<=', $input );
$input = wp_kses_split( $input, array(), array() );
$input = str_replace( '>', '>', $input );
$input = strip_tags( $input );
return $input;
}
else {
return '';
}
}
function prefix_sanitize_integer( $input ) {
return $input;
}
/*********** Custom CSS ************************************************************/
function asmartgs_custom_css() {
global $asmartgs_settings;
$asmartgs_settings = wp_parse_args( get_option( 'asmartgs_theme_options', array() ), asmartgs_get_option_defaults_values() );
if (!empty($asmartgs_settings['asmartgs_custom_css']) ){
$asmartgs_internal_css = ''."\n";
$asmartgs_internal_css .= ''."\n";
}
if (isset($asmartgs_internal_css)) {
echo $asmartgs_internal_css;
}
}
add_filter( 'wp_head', 'asmartgs_custom_css');
add_action( 'wp_head', 'asmartgs_infobar_information');
function asmartgs_infobar_information() {
global $asmartgs_settings,$array_of_default_settings;
$asmartgs_settings = wp_parse_args( get_option( 'asmartgs_theme_settings', array() ), asmartgs_get_option_defaults_values() );
$content_layout = $asmartgs_settings['content_layout'];
if ('left' == $content_layout) { ?>