remove_section('background_image');
// General
$wp_customize->add_section(
'general_settings_section',
array(
'title' => __( 'General Settings', 'boatdealer' ),
'priority' => 1,
'capability' => 'edit_theme_options',
'description' => __('Change General options here.', 'boatdealer'),
)
);
$wp_customize->add_setting( 'my_menus_enabled', array(
'default' =>'1' ,
'sanitize_callback' =>'vertical_sanitize_nothing',
));
$wp_customize->add_control(
'my_menus_enabled',
array(
'settings' => 'my_menus_enabled',
'section' => 'general_settings_section',
'type' => 'radio',
'label' => __( 'Menus enabled', 'boatdealer' ),
'description' => '',
'sanitize_callback' => 'vertical_sanitize_number',
'choices' => array(
'1' => __( 'Only Vertical Left Menu', 'boatdealer' ),
'2' => __( 'Only Horizontal Top Menu', 'boatdealer' ),
'3' => __( 'Both', 'boatdealer' )
)
)
);
$wp_customize->add_setting('my_custom_css', array(
'sanitize_callback' =>'vertical_sanitize_nothing',
));
$wp_customize->add_control('my_custom_css', array(
'label' => __( 'Write or paste Custom Css Code', 'boatdealer' ),
'section' => 'general_settings_section',
'description' => '',
'type' => 'textarea',
'sanitize_callback' => 'vertical_sanitize_css',
));
$wp_customize->add_setting('my_analytics_code', array(
'sanitize_callback' =>'vertical_sanitize_nothing',
));
$wp_customize->add_control('my_analytics_code', array(
'label' => __( 'Google Analytics Code', 'boatdealer' ),
'section' => 'general_settings_section',
'type' => 'textarea',
'sanitize_callback' => 'vertical_sanitize_analytics',
));
$wp_customize->add_setting('my_layout_type', array(
'sanitize_callback' =>'vertical_sanitize_nothing',
'default' => '2'
));
$wp_customize->add_control(
'my_layout_type',
array(
'settings' => 'my_layout_type',
'section' => 'general_settings_section',
'type' => 'radio',
'label' => __( 'Website Layout', 'boatdealer' ) ,
'description' => '',
'sanitize_callback' => 'vertical_sanitize_number',
'choices' => array(
'1' => 'Boxed Width 1000px',
'2' => 'Wide'
)
)
);
$wp_customize->add_setting('my_opacity', array(
'sanitize_callback' =>'vertical_sanitize_nothing',
'default' => '10'
));
$wp_customize->add_control( 'my_opacity', array(
'type' => 'range',
'section' => 'general_settings_section',
'label' => __( 'Background transparency (opacity)', 'boatdealer' ),
'description' => __( 'Choose from .6 to 1', 'boatdealer' ),
'sanitize_callback' => 'vertical_sanitize_number',
'input_attrs' => array(
'min' => 6,
'max' => 10,
'step' => 1,
),
) );
$wp_customize->add_setting('my_entry_title', array(
'sanitize_callback' =>'vertical_sanitize_number',
'default' => '2',
));
$wp_customize->add_control(
'my_entry_title',
array(
'settings' => 'my_entry_title',
'section' => 'general_settings_section',
'type' => 'radio',
'label' => __( 'Show entry-title', 'boatdealer' ),
'description' => '',
'sanitize_callback' => 'vertical_sanitize_number',
'choices' => array(
'1' => 'Yes',
'2' => 'No'
)
)
);
/*
$wp_customize->add_setting( 'my_favicon',
array(
'default' => '',
'sanitize_callback' => 'esc_url_raw',
)
);
$wp_customize->add_control(
new WP_Customize_Image_Control(
// $wp_customize object
$wp_customize,
// $id
'my_favicon',
// $args
array(
'settings' => 'my_favicon',
'section' => 'general_settings_section',
'label' => __( 'Choose Favicon Image', 'boatdealer' ),
'description' => __( 'Select the image to be used for the Favicon.', 'boatdealer' ),
'sanitize_callback' =>'esc_url_raw',
)
)
);
*/
// Fim General
// Header
$wp_customize->add_section(
'header_settings_section',
array(
'title' => __( 'Header Settings', 'boatdealer' ),
'priority' => 1,
'capability' => 'edit_theme_options',
'description' => '',
)
);
$wp_customize->add_setting('site_logo', array(
'sanitize_callback' =>'vertical_sanitize_nothing',
'default' => ''
));
$wp_customize->add_control(
new WP_Customize_Image_Control(
// $wp_customize object
$wp_customize,
// $id
'site_logo',
// $args
array(
'settings' => 'site_logo',
'section' => 'header_settings_section',
'label' => __( 'Site Logo', 'boatdealer' ),
'description' => __( 'Select the image to be used for the site logo.', 'boatdealer' ),
'sanitize_callback' => 'esc_url_raw',
)
)
);
$wp_customize->add_setting('my_logo_height', array(
'sanitize_callback' =>'vertical_sanitize_nothing',
'default' => '200'
));
$wp_customize->add_control( 'my_logo_height', array(
'type' => 'range',
'section' => 'header_settings_section',
'label' => __( 'Logo Height', 'boatdealer' ),
'description' => __( 'Choose from 20 to 300 Pixels.', 'boatdealer' ),
'sanitize_callback' => 'vertical_sanitize_number',
'input_attrs' => array(
'min' => 20,
'max' => 300,
'step' => 5,
),
) );
$wp_customize->add_setting('my_logo_margin_top', array(
'sanitize_callback' =>'vertical_sanitize_nothing',
'default' => '10'
));
$wp_customize->add_control( 'my_logo_margin_top', array(
'type' => 'range',
'section' => 'header_settings_section',
'label' => __( 'Logo Margin Top', 'boatdealer' ),
'description' => __( 'Choose from 0 to 30 Pixels.', 'boatdealer' ),
'sanitize_callback' => 'vertical_sanitize_number',
'input_attrs' => array(
'min' => 0,
'max' => 30,
'step' => 1,
),
) );
$wp_customize->add_setting('my_widgets_show', array(
'sanitize_callback' =>'vertical_sanitize_checkbox',
'default' => ''
));
$wp_customize->add_control(
// $id
'my_widgets_show',
array(
'settings' => 'my_widgets_show',
'section' => 'header_settings_section',
'type' => 'checkbox',
'sanitize_callback' => 'vertical_sanitize_checkbox',
'label' => __( 'Activate Header Widget', 'boatdealer' ),
'description' => __( 'Check to Activate.', 'boatdealer' ), )
);
$wp_customize->add_setting('my_search_icon', array(
'sanitize_callback' =>'vertical_sanitize_nothing',
'default' => 'Gray'
));
$wp_customize->add_control(
'my_search_icon',
array(
'settings' => 'my_search_icon',
'section' => 'header_settings_section',
'type' => 'radio',
'label' => __( 'My Search Icon Color', 'boatdealer' ),
'description' => __( 'Find this icon at bottom right corner of the header.', 'boatdealer' ),
'sanitize_callback' => 'sanitize_text_field',
'choices' => array(
'White' => __( 'White', 'boatdealer' ),
'Gray' => __( 'Light Gray', 'boatdealer' ),
'No' => __( 'Hidden', 'boatdealer' ),
)
)
);
// Fim Header
// Background
$wp_customize->add_section(
'background_settings_section',
array(
'title' => __( 'Background Settings', 'boatdealer' ),
'priority' => 1,
'capability' => 'edit_theme_options',
'description' => __('Change Background options here.', 'boatdealer'),
)
);
$wp_customize->add_setting('my_background_color', array(
'sanitize_callback' =>'vertical_sanitize_nothing',
'default' => 'fififi'
));
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'my_background_color', array(
'label' => __( 'Background Color', 'boatdealer' ),
'section' => 'background_settings_section',
'settings' => 'my_background_color',
'priority' => 1,
'sanitize_callback' => 'sanitize_hex_color',
// 'active_callback' => 'image_background',
)
)
);
$wp_customize->add_setting('my_background_image', array(
'sanitize_callback' =>'vertical_sanitize_nothing',
'default' => ''
));
$wp_customize->add_control(
new WP_Customize_Image_Control(
// $wp_customize object
$wp_customize,
// $id
'my_background_image',
// $args
array(
'settings' => __( 'my_background_image', 'boatdealer' ),
'section' => 'background_settings_section',
'label' => __( 'Background Image', 'boatdealer' ),
'sanitize_callback' => 'esc_url_raw',
)
)
);
function img_background($control) {
if ( $control->manager->get_setting('my_background_image')->value() <> '' ) {
return true;
} else {
return false;
}
}
$wp_customize->add_setting('my_background_repeat', array(
'sanitize_callback' =>'vertical_sanitize_nothing',
'default' => 'No'
));
$wp_customize->add_control(
'my_background_repeat',
array(
'settings' => 'my_background_repeat',
'section' => 'background_settings_section',
'type' => 'radio',
'label' => __( 'Background Repeat', 'boatdealer' ),
'description' => '',
'active_callback' => 'img_background',
'sanitize_callback' => 'vertical_sanitize_text',
'choices' => array(
'No' => __( 'No Repeat', 'boatdealer' ),
'Yes' => __( 'Tile', 'boatdealer' ),
'X' => __( 'Tile Horizontally', 'boatdealer' ),
'Y' => __( 'Tile Vertically', 'boatdealer' )
)
)
);
$wp_customize->add_setting('my_background_position', array(
'sanitize_callback' =>'vertical_sanitize_nothing',
'default' => 'Center'
));
$wp_customize->add_control(
'my_background_position',
array(
'settings' => 'my_background_position',
'section' => 'background_settings_section',
'type' => 'radio',
'label' => __( 'Background Position', 'boatdealer' ),
'description' => '',
'active_callback' => 'img_background',
'sanitize_callback' => 'vertical_sanitize_text',
'choices' => array(
'Left' => __( 'Left', 'boatdealer' ),
'Center' => __( 'Center', 'boatdealer' ),
'Right' => __( 'Right', 'boatdealer' ),
)
)
);
$wp_customize->add_setting('my_background_attachment', array(
'sanitize_callback' =>'vertical_sanitize_nothing',
'default' => 'Fixed'
));
$wp_customize->add_control(
'my_background_attachment',
array(
'settings' => 'my_background_attachment',
'section' => 'background_settings_section',
'type' => 'radio',
'label' => __( 'Background Attachment', 'boatdealer' ),
'description' => '',
'active_callback' => 'img_background',
'sanitize_callback' => 'vertical_sanitize_text',
'choices' => array(
'scroll' => __( 'Scroll', 'boatdealer' ),
'fixed' => __( 'Fixed', 'boatdealer' )
)
)
);
$wp_customize->add_setting('my_background_cover', array(
'sanitize_callback' =>'vertical_sanitize_nothing',
'default' => ''
));
$wp_customize->add_control(
// $id
'my_background_cover',
// $args
array(
'settings' => 'my_background_cover',
'section' => 'background_settings_section',
'type' => 'checkbox',
'active_callback' => 'img_background',
'sanitize_callback' => 'vertical_sanitize_checkbox',
'label' => __( 'Image Background Cover 100%', 'boatdealer' ),
// 'description' => __( 'Should the Theme developer credit link be displayed in your site footer?', 'boatdealer' ),
)
);
// Fim Background
// Footer
$wp_customize->add_section(
'footer_settings_section',
array(
'title' => __( 'Footer Settings', 'boatdealer' ),
'priority' => 11,
'capability' => 'edit_theme_options',
'description' => '',
)
);
$wp_customize->add_setting('display_footer_credit', array(
'sanitize_callback' =>'vertical_sanitize_nothing',
'default' => ''
));
function choice_a_footer_text( $control ) {
if ( $control->manager->get_setting('display_footer_credit')->value() == '1' ) {
return true;
} else {
return false;
}
}
$wp_customize->add_control(
// $id
'display_footer_credit',
// $args
array(
'settings' => 'display_footer_credit',
'section' => 'footer_settings_section',
'type' => 'checkbox',
'sanitize_callback' => 'vertical_sanitize_checkbox',
'label' => __( 'Display Footer Copyright Text', 'boatdealer' ),
)
);
$wp_customize->add_setting('my_footer_copyright', array(
'sanitize_callback' =>'vertical_sanitize_nothing',
'default' => '',
));
$wp_customize->add_control('my_footer_copyright', array(
'label' => __( 'Copyright Footer Text Here', 'boatdealer' ),
'section' => 'footer_settings_section',
'type' => 'textarea',
'active_callback' => 'choice_a_footer_text',
'sanitize_callback' => 'sanitize_text_field',
));
$wp_customize->add_setting( 'my_copyright_background',
array(
'default' => 'f1f1f1',
'sanitize_callback' =>'vertical_sanitize_nothing',
)
);
$wp_customize->add_setting('my_copyright_background', array(
'default' => '',
'sanitize_callback' => 'sanitize_hex_color',
));
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'my_copyright_background', array(
'label' => __( 'Copyright Background Color', 'boatdealer' ),
'section' => 'footer_settings_section',
'settings' => 'my_copyright_background',
'priority' => 20,
'active_callback' => 'choice_a_footer_text',
'sanitize_callback' => 'vertical_sanitize_text',
)
)
);
$wp_customize->add_setting( 'my_copyright_color',
array(
'default' => 'f1f1f1',
'sanitize_callback' =>'vertical_sanitize_nothing',
)
);
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'my_copyright_color', array(
'label' => __( 'Copyright Text Color', 'boatdealer' ),
'section' => 'footer_settings_section',
'settings' => 'my_copyright_color',
'priority' => 30,
'sanitize_callback' => 'sanitize_hex_color',
'active_callback' => 'choice_a_footer_text',
)
)
);
$color_scheme = boatdealer_get_color_scheme();
$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
// Add color scheme setting and control.
$wp_customize->add_setting( 'color_scheme', array(
'default' => 'default',
'sanitize_callback' => 'boatdealer_sanitize_color_scheme',
'transport' => 'postMessage',
) );
$wp_customize->add_control( 'color_scheme', array(
'label' => __( 'Base Color Scheme', 'boatdealer' ),
'section' => 'colors',
'type' => 'select',
'sanitize_callback' => 'sanitize_hex_text',
'choices' => boatdealer_get_color_scheme_choices(),
'priority' => 1,
) );
// Add custom header and sidebar text color setting and control.
$wp_customize->add_setting( 'sidebar_textcolor', array(
'default' => $color_scheme[4],
'sanitize_callback' => 'sanitize_hex_color',
'transport' => 'postMessage',
) );
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'sidebar_textcolor', array(
'label' => __( 'Header and Sidebar Text Color', 'boatdealer' ),
'description' => __( 'Applied to the header on small screens and the sidebar on wide screens.', 'boatdealer' ),
'section' => 'colors',
) ) );
// Remove the core header textcolor control, as it shares the sidebar text color.
$wp_customize->remove_control( 'header_textcolor' );
// Add custom header and sidebar background color setting and control.
$wp_customize->add_setting( 'header_background_color', array(
'default' => $color_scheme[1],
'sanitize_callback' => 'sanitize_hex_color',
'transport' => 'postMessage',
) );
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'header_background_color', array(
'label' => __( 'Header and Sidebar Background Color', 'boatdealer' ),
'description' => __( 'Applied to the header on small screens and the sidebar on wide screens.', 'boatdealer' ),
'section' => 'colors',
'sanitize_callback' => 'sanitize_hex_color',
) ) );
// Add an additional description to the header image section.
$wp_customize->get_section( 'header_image' )->description = __( 'Applied to the header on small screens and the sidebar on wide screens.', 'boatdealer' );
/////////// Navigation Details
$wp_customize->add_section(
'navigation_colors_section',
array(
'title' => __( 'Top Navigation Design', 'boatdealer' ),
'priority' => 101,
'capability' => 'edit_theme_options',
'description' => __('Change Top Navigation detais here.
If you install WooCommerce, maybe you will need set this Top Margin around 50 pixels to left space for their menu.', 'boatdealer'),
)
);
$wp_customize->add_setting( 'my_menu_margin_top',
array(
'default' => '10',
'sanitize_callback' =>'vertical_sanitize_nothing',
)
);
$wp_customize->add_control( 'my_menu_margin_top', array(
'type' => 'range',
'section' => 'navigation_colors_section',
'label' => __( 'Menu Margin Top', 'boatdealer' ),
'description' => __( 'Choose from 0 to 50 Pixels.', 'boatdealer' ),
'sanitize_callback' => 'vertical_sanitize_number',
'input_attrs' => array(
'min' => 0,
'max' => 50,
'step' => 1,
),
) );
$wp_customize->add_setting( 'menu_font_size',
array(
'default' => '14',
'sanitize_callback' =>'vertical_sanitize_number',
)
);
$wp_customize->add_control( 'menu_font_size', array(
'type' => 'range',
'section' => 'navigation_colors_section',
'label' => __( 'Menu Font Size', 'boatdealer' ),
'description' => __( 'Choose from 12 to 18 Pixels.', 'boatdealer' ),
'sanitize_callback' => 'vertical_sanitize_number',
'input_attrs' => array(
'min' => 12,
'max' => 18,
'step' => 1,
),
) );
function choice_a_background_color( $control ) {
if ( $control->manager->get_setting('display_background_navigation_color')->value() == '1' ) {
return true;
} else {
return false;
}
}
$wp_customize->add_setting('display_background_navigation_color', array(
'default' => '',
'sanitize_callback' => 'vertical_sanitize_checkbox',
));
$wp_customize->add_control(
// $id
'display_background_navigation_color',
// $args
array(
'settings' => 'display_background_navigation_color',
'section' => 'navigation_colors_section',
'type' => 'checkbox',
'sanitize_callback' => 'vertical_sanitize_checkbox',
'label' => __( 'Check to Use Background Navigation Color', 'boatdealer' ),
// 'description' => __( 'Should the Theme developer credit link be displayed in your site footer?', 'boatdealer' ),
)
);
$wp_customize->add_setting( 'my_navigation_background',
array(
'default' => 'f1f1f1',
'sanitize_callback' => 'sanitize_hex_color',
)
);
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'my_navigation_background', array(
'label' => __( 'Background Navigation Color', 'boatdealer' ),
'section' => 'navigation_colors_section',
'settings' => 'my_navigation_background',
'priority' => 10,
'sanitize_callback' => 'sanitize_hex_color',
'active_callback' => 'choice_a_background_color',
)
)
);
$wp_customize->add_setting( 'my_menu_color',
array(
'default' => 'f1f1f1',
'sanitize_callback' => 'sanitize_hex_color',
)
);
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'my_menu_color', array(
'label' => __( 'Menu Text Color', 'boatdealer' ),
'section' => 'navigation_colors_section',
'settings' => 'my_menu_color',
'sanitize_callback' => 'sanitize_hex_color',
'priority' => 10,
)
)
);
$wp_customize->add_setting( 'my_menu_hover_color',
array(
'default' => '000000',
'sanitize_callback' => 'sanitize_hex_color',
)
);
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'my_menu_hover_color', array(
'label' => __( 'Menu Text Hover Color', 'boatdealer' ),
'section' => 'navigation_colors_section',
'settings' => 'my_menu_hover_color',
'sanitize_callback' => 'sanitize_hex_color',
'priority' => 10,
)
)
);
$wp_customize->add_setting( 'my_sub_menu_text_color',
array(
'default' => 'f1f1f1',
'sanitize_callback' => 'sanitize_hex_color',
)
);
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'my_sub_menu_text_color', array(
'label' => __( 'Sub Menu Text Color', 'boatdealer' ),
'section' => 'navigation_colors_section',
'settings' => 'my_sub_menu_text_color',
'sanitize_callback' => 'sanitize_hex_color',
'priority' => 10,
)
)
);
$wp_customize->add_setting( 'my_menu_background',
array(
'default' => 'f1f1f1',
'sanitize_callback' => 'sanitize_hex_color',
)
);
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'my_menu_background', array(
'label' => __( 'Sub Menu Background', 'boatdealer' ),
'section' => 'navigation_colors_section',
'settings' => 'my_menu_background',
'sanitize_callback' => 'sanitize_hex_color',
'priority' => 10,
)
)
);
$wp_customize->add_setting( 'my_submenu_hover_color',
array(
'default' => 'f1f1f1',
'sanitize_callback' => 'sanitize_hex_color',
)
);
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'my_submenu_hover_color', array(
'label' => __( 'Sub Menu Hover color', 'boatdealer' ),
'section' => 'navigation_colors_section',
'settings' => 'my_submenu_hover_color',
'sanitize_callback' => 'sanitize_hex_color',
'priority' => 10,
)
)
);
$wp_customize->add_setting( 'my_submenu_hover_background',
array(
'default' => 'f1f1f1',
'sanitize_callback' => 'sanitize_hex_color',
)
);
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'my_submenu_hover_background', array(
'label' => __( 'Sub Menu Hover Background', 'boatdealer' ),
'section' => 'navigation_colors_section',
'settings' => 'my_submenu_hover_background',
'sanitize_callback' => 'sanitize_hex_color',
'priority' => 10,
)
)
);
/* Sanitize */
function vertical_sanitize_text( $str ) {
return sanitize_text_field( $str );
}
function vertical_sanitize_textarea( $text ) {
return esc_textarea( $text );
}
function vertical_sanitize_number( $int ) {
return absint( $int );
}
function vertical_sanitize_css( $text ) {
return $text;
}
function vertical_sanitize_analytics( $text ) {
return $text;
}
function vertical_sanitize_checkbox( $input ) {
if ( $input == 1 ) {
return 1;
} else {
return '';
}
}
function vertical_sanitize_nothing( $text ) {
return $text;
}
}
add_action( 'customize_register', 'boatdealer_customize_register', 11 );
/**
* Register color schemes for boat dealer.
*
* Can be filtered with {@see 'boatdealer_color_schemes'}.
*
* The order of colors in a colors array:
* 1. Main Background Color.
* 2. Sidebar Background Color.
* 3. Box Background Color.
* 4. Main Text and Link Color.
* 5. Sidebar Text and Link Color.
* 6. Meta Box Background Color.
*
* @since boat dealer 1.0
*
* @return array An associative array of color scheme options.
*/
function boatdealer_get_color_schemes() {
return apply_filters( 'boatdealer_color_schemes', array(
'default' => array(
'label' => __( 'Default', 'boatdealer' ),
'colors' => array(
'#f1f1f1',
'#ffffff',
'#ffffff',
'#333333',
'#333333',
'#f7f7f7',
),
),
'dark' => array(
'label' => __( 'Dark', 'boatdealer' ),
'colors' => array(
'#111111',
'#202020',
'#202020',
'#bebebe',
'#bebebe',
'#1b1b1b',
),
),
'Green' => array(
'label' => __( 'Green', 'boatdealer' ),
'colors' => array(
'#CED7CE',
'#067F44',
'#ffffff',
'#111111',
'#ffffff',
'#f1f1f1',
),
),
'red' => array(
'label' => __( 'Red', 'boatdealer' ),
'colors' => array(
'#ffe5d1',
'#e53b51',
'#ffffff',
'#352712',
'#ffffff',
'#f1f1f1',
),
),
'orange' => array(
'label' => __( 'Orange', 'boatdealer' ),
'colors' => array(
'#ffe5d1',
'#FF6726',
'#ffffff',
'#FF6726',
'#ffffff',
'#f1f1f1',
),
),
'blue' => array(
'label' => __( 'Blue', 'boatdealer' ),
'colors' => array(
'#e9f2f9',
'#00608E',
'#ffffff',
'#22313f',
'#ffffff',
'#f1f1f1',
),
),
'brown' => array(
'label' => __( 'Brown', 'boatdealer' ),
'colors' => array(
'#D6CEBB',
'#A27500',
'#ffffff',
'#22313f',
'#ffffff',
'#f1f1f1',
),
),
) );
}
if ( ! function_exists( 'boatdealer_get_color_scheme' ) ) :
/**
* Get the current boat dealer color scheme.
*
* @since boat dealer 1.0
*
* @return array An associative array of either the current or default color scheme hex values.
*/
function boatdealer_get_color_scheme() {
$color_scheme_option = get_theme_mod( 'color_scheme', 'default' );
$color_schemes = boatdealer_get_color_schemes();
if ( array_key_exists( $color_scheme_option, $color_schemes ) ) {
return $color_schemes[ $color_scheme_option ]['colors'];
}
return $color_schemes['default']['colors'];
}
endif; // boatdealer_get_color_scheme
if ( ! function_exists( 'boatdealer_get_color_scheme_choices' ) ) :
/**
* Returns an array of color scheme choices registered for boat dealer.
*
* @since boat dealer 1.0
*
* @return array Array of color schemes.
*/
function boatdealer_get_color_scheme_choices() {
$color_schemes = boatdealer_get_color_schemes();
$color_scheme_control_options = array();
foreach ( $color_schemes as $color_scheme => $value ) {
$color_scheme_control_options[ $color_scheme ] = $value['label'];
}
return $color_scheme_control_options;
}
endif; // boatdealer_get_color_scheme_choices
if ( ! function_exists( 'boatdealer_sanitize_color_scheme' ) ) :
/**
* Sanitization callback for color schemes.
*
* @since boat dealer 1.0
*
* @param string $value Color scheme name value.
* @return string Color scheme name.
*/
function boatdealer_sanitize_color_scheme( $value ) {
$color_schemes = boatdealer_get_color_scheme_choices();
if ( ! array_key_exists( $value, $color_schemes ) ) {
$value = 'default';
}
return $value;
}
endif; // boatdealer_sanitize_color_scheme
/**
* Enqueues front-end CSS for color scheme.
*
* @since boat dealer 1.0
*
* @see wp_add_inline_style()
*/
function boatdealer_color_scheme_css() {
$color_scheme_option = get_theme_mod( 'color_scheme', 'default' );
// Don't do anything if the default color scheme is selected.
if ( 'default' === $color_scheme_option ) {
return;
}
$color_scheme = boatdealer_get_color_scheme();
// Convert main and sidebar text hex color to rgba.
$color_textcolor_rgb = boatdealer_hex2rgb( $color_scheme[3] );
$color_sidebar_textcolor_rgb = boatdealer_hex2rgb( $color_scheme[4] );
$colors = array(
'background_color' => $color_scheme[0],
'header_background_color' => $color_scheme[1],
'box_background_color' => $color_scheme[2],
'textcolor' => $color_scheme[3],
'secondary_textcolor' => vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.7)', $color_textcolor_rgb ),
'border_color' => vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.1)', $color_textcolor_rgb ),
'border_focus_color' => vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.3)', $color_textcolor_rgb ),
'sidebar_textcolor' => $color_scheme[4],
'sidebar_border_color' => vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.1)', $color_sidebar_textcolor_rgb ),
'sidebar_border_focus_color' => vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.3)', $color_sidebar_textcolor_rgb ),
'secondary_sidebar_textcolor' => vsprintf( 'rgba( %1$s, %2$s, %3$s, 0.7)', $color_sidebar_textcolor_rgb ),
'meta_box_background_color' => $color_scheme[5],
);
$header_background_color = get_theme_mod('header_background_color', '#ffffff' );
if(!empty($header_background_color))
$colors['header_background_color'] = $header_background_color;
$color_scheme_css = boatdealer_get_color_scheme_css( $colors );
wp_add_inline_style( 'boatdealer-style', $color_scheme_css );
}
add_action( 'wp_enqueue_scripts', 'boatdealer_color_scheme_css' );
/**
* Binds JS listener to make Customizer color_scheme control.
*
* Passes color scheme data as colorScheme global.
*
* @since boat dealer 1.0
*/
function boatdealer_customize_control_js() {
wp_enqueue_script( 'color-scheme-control', get_template_directory_uri() . '/js/color-scheme-control.js', array( 'customize-controls', 'iris', 'underscore', 'wp-util' ), '20141216', true );
wp_localize_script( 'color-scheme-control', 'colorScheme', boatdealer_get_color_schemes() );
}
add_action( 'customize_controls_enqueue_scripts', 'boatdealer_customize_control_js' );
/**
* Binds JS handlers to make the Customizer preview reload changes asynchronously.
*
* @since boat dealer 1.0
*/
function boatdealer_customize_preview_js() {
wp_enqueue_script( 'boatdealer-customize-preview', get_template_directory_uri() . '/js/customize-preview.js', array( 'customize-preview' ), '20141216', true );
}
add_action( 'customize_preview_init', 'boatdealer_customize_preview_js' );
/* Bill */
add_action ('customize_controls_enqueue_scripts' , 'customize_scripts' );
function customize_scripts() {
wp_enqueue_style (
'jaxlite_panel',
get_template_directory_uri() . '/inc/customize.css',
array(),
''
);
wp_enqueue_script(
'customizer-preview',
get_template_directory_uri().'/inc/customizer-preview.js',
array( 'jquery' ),
'1.0.0',
true
);
$jaxlite_details = array(
'label' => 'Upgrade to Premium',
'url' => esc_url('http://boatdealerthemes.com/premum/'),
'label_guide' => 'Theme Guide Online',
'url_guide' => esc_url('http://boatdealerthemes.com/documentation/')
);
wp_localize_script( 'customizer-preview', 'boatdealer_details', $jaxlite_details );
}
/* Fim Bill */
/**
* Returns CSS for the color schemes.
*
* @since boat dealer 1.0
*
* @param array $colors Color scheme colors.
* @return string Color scheme CSS.
*/
function boatdealer_get_color_scheme_css( $colors ) {
$colors = wp_parse_args( $colors, array(
'background_color' => '',
'header_background_color' => '',
'box_background_color' => '',
'textcolor' => '',
'secondary_textcolor' => '',
'border_color' => '',
'border_focus_color' => '',
'sidebar_textcolor' => '',
'sidebar_border_color' => '',
'sidebar_border_focus_color' => '',
'secondary_sidebar_textcolor' => '',
'meta_box_background_color' => '',
) );
$my_opacity = get_theme_mod('my_opacity',10)/10;
$css = << a,
.author-description a,
.taxonomy-description a,
.textwidget a,
.entry-footer a:hover,
.comment-metadata a:hover,
.pingback .edit-link a:hover,
.comment-list .reply a:hover,
.site-info a:hover {
border-color: {$colors['textcolor']};
}
/* Secondary Text Color */
button:hover,
button:focus,
input[type="button"]:hover,
input[type="button"]:focus,
input[type="reset"]:hover,
input[type="reset"]:focus,
input[type="submit"]:hover,
input[type="submit"]:focus,
.pagination .prev:hover,
.pagination .prev:focus,
.pagination .next:hover,
.pagination .next:focus,
.widget_calendar tbody a:hover,
.widget_calendar tbody a:focus,
.page-links a:hover,
.page-links a:focus {
background-color: {$colors['textcolor']}; /* Fallback for IE7 and IE8 */
background-color: {$colors['secondary_textcolor']};
}
/* Secondary Text Color */
blockquote,
a:hover,
a:focus,
.main-navigation .menu-item-description,
.post-navigation .meta-nav,
.post-navigation a:hover .post-title,
.post-navigation a:focus .post-title,
.image-navigation,
.image-navigation a,
.comment-navigation,
.comment-navigation a,
.widget,
.author-heading,
.entry-footer,
.entry-footer a,
.taxonomy-description,
.page-links > .page-links-title,
.entry-caption,
.comment-author,
.comment-metadata,
.comment-metadata a,
.pingback .edit-link,
.pingback .edit-link a,
.post-password-form label,
.comment-form label,
.comment-notes,
.comment-awaiting-moderation,
.logged-in-as,
.form-allowed-tags,
.no-comments,
.site-info,
.site-info a,
.wp-caption-text,
.gallery-caption,
.comment-list .reply a,
.widecolumn label,
.widecolumn .mu_register label {
color: {$colors['textcolor']}; /* Fallback for IE7 and IE8 */
color: {$colors['secondary_textcolor']};
}
/* Secondary Text Color */
blockquote,
.logged-in-as a:hover,
.comment-author a:hover {
border-color: {$colors['textcolor']}; /* Fallback for IE7 and IE8 */
border-color: {$colors['secondary_textcolor']};
}
/* Border Color */
hr,
.dropdown-toggle:hover,
.dropdown-toggle:focus {
background-color: {$colors['textcolor']}; /* Fallback for IE7 and IE8 */
background-color: {$colors['border_color']};
}
/* Border Color */
pre,
abbr[title],
table,
th,
td,
input,
textarea,
.main-navigation ul,
.main-navigation li,
.post-navigation,
.post-navigation div + div,
.pagination,
.comment-navigation,
.widget li,
.widget_categories .children,
.widget_nav_menu .sub-menu,
.widget_pages .children,
.site-header,
.site-footer,
.hentry + .hentry,
.author-info,
.entry-content .page-links a,
.page-links > span,
.page-header,
.comments-area,
.comment-list + .comment-respond,
.comment-list article,
.comment-list .pingback,
.comment-list .trackback,
.comment-list .reply a,
.no-comments {
border-color: {$colors['textcolor']}; /* Fallback for IE7 and IE8 */
border-color: {$colors['border_color']};
}
/* Border Focus Color */
a:focus,
button:focus,
input:focus {
outline-color: {$colors['textcolor']}; /* Fallback for IE7 and IE8 */
outline-color: {$colors['border_focus_color']};
}
input:focus,
textarea:focus {
border-color: {$colors['textcolor']}; /* Fallback for IE7 and IE8 */
border-color: {$colors['border_focus_color']};
}
/* Sidebar Link Color */
.secondary-toggle:before {
color: {$colors['sidebar_textcolor']};
}
.site-title a,
.site-description {
color: {$colors['sidebar_textcolor']};
}
/* Sidebar Text Color */
.site-title a:hover,
.site-title a:focus {
color: {$colors['secondary_sidebar_textcolor']};
}
/* Sidebar Border Color */
.secondary-toggle {
border-color: {$colors['sidebar_textcolor']}; /* Fallback for IE7 and IE8 */
border-color: {$colors['sidebar_border_color']};
}
/* Sidebar Border Focus Color */
.secondary-toggle:hover,
.secondary-toggle:focus {
border-color: {$colors['sidebar_textcolor']}; /* Fallback for IE7 and IE8 */
border-color: {$colors['sidebar_border_focus_color']};
}
.site-title a {
outline-color: {$colors['sidebar_textcolor']}; /* Fallback for IE7 and IE8 */
outline-color: {$colors['sidebar_border_focus_color']};
}
/* Meta Background Color */
.entry-footer {
background-color: {$colors['meta_box_background_color']};
}
@media screen and (min-width: 38.75em) {
/* Main Text Color */
.page-header {
border-color: {$colors['textcolor']};
}
}
/* Bill aqui o erro era 59.6875em */
@media screen and (min-width: 15em) {
/* Make sure its transparent on desktop */
/* // Bill ////////////////////////////// */
button,
input[type="button"],
input[type="reset"],
input[type="submit"],
input[type="file"],
.pagination .prev,
.pagination .next,
.widget_calendar tbody a,
.page-links a,
.sticky-post {
background-color: {$colors['header_background_color']} ;
color: {$colors['sidebar_textcolor']};
border: solid 1px #DAD9D9 !important; /* {$colors['sidebar_textcolor']} */
}
.site-header,
.secondary {
background-color: transparent;
}
/* Sidebar Background Color */
.widget button,
.widget input[type="button"],
.widget input[type="reset"],
.widget input[type="submit"],
.widget_calendar tbody a,
.widget_calendar tbody a:hover,
.widget_calendar tbody a:focus {
color: {$colors['header_background_color']};
}
/* Sidebar Link Color */
.secondary a,
.dropdown-toggle:after,
.widget-title,
.widget blockquote cite,
.widget blockquote small {
color: {$colors['sidebar_textcolor']};
}
.widget button,
.widget input[type="button"],
.widget input[type="reset"],
.widget input[type="submit"],
.widget_calendar tbody a {
background-color: {$colors['sidebar_textcolor']};
}
.textwidget a {
border-color: {$colors['sidebar_textcolor']};
}
/* Sidebar Text Color */
.secondary a:hover,
.secondary a:focus,
.main-navigation .menu-item-description,
.widget,
.widget blockquote,
.widget .wp-caption-text,
.widget .gallery-caption {
color: {$colors['secondary_sidebar_textcolor']};
}
.widget button:hover,
.widget button:focus,
.widget input[type="button"]:hover,
.widget input[type="button"]:focus,
.widget input[type="reset"]:hover,
.widget input[type="reset"]:focus,
.widget input[type="submit"]:hover,
.widget input[type="submit"]:focus,
.widget_calendar tbody a:hover,
.widget_calendar tbody a:focus {
background-color: {$colors['secondary_sidebar_textcolor']};
}
.widget blockquote {
border-color: {$colors['secondary_sidebar_textcolor']};
}
/* Sidebar Border Color */
.main-navigation ul,
.main-navigation li,
.widget input,
.widget textarea,
.widget table,
.widget th,
.widget td,
.widget pre,
.widget li,
.widget_categories .children,
.widget_nav_menu .sub-menu,
.widget_pages .children,
.widget abbr[title] {
border-color: {$colors['sidebar_border_color']};
}
.dropdown-toggle:hover,
.dropdown-toggle:focus,
.widget hr {
background-color: {$colors['sidebar_border_color']};
}
.widget input:focus,
.widget textarea:focus {
border-color: {$colors['sidebar_border_focus_color']};
}
.sidebar a:focus,
.dropdown-toggle:focus {
outline-color: {$colors['sidebar_border_focus_color']};
}
}
CSS;
return $css;
}
add_action( 'wp_head' , 'my_dynamic_css' );
//echo get_theme_mod('footer_bg_color');
// die();
function my_dynamic_css() {
global $mystickyheight;
?>
'{{ data.background_color }}',
'header_background_color' => '{{ data.header_background_color }}',
'box_background_color' => '{{ data.box_background_color }}',
'textcolor' => '{{ data.textcolor }}',
'secondary_textcolor' => '{{ data.secondary_textcolor }}',
'border_color' => '{{ data.border_color }}',
'border_focus_color' => '{{ data.border_focus_color }}',
'sidebar_textcolor' => '{{ data.sidebar_textcolor }}',
'sidebar_border_color' => '{{ data.sidebar_border_color }}',
'sidebar_border_focus_color' => '{{ data.sidebar_border_focus_color }}',
'secondary_sidebar_textcolor' => '{{ data.secondary_sidebar_textcolor }}',
'meta_box_background_color' => '{{ data.meta_box_background_color }}',
);
?>
1)
// die('erro');
// else
// die('ok');