Yuzu Theme

from meowapps.com
This commit is contained in:
2022-05-03 09:37:05 +02:00
commit 523ccac38e
75 changed files with 15482 additions and 0 deletions

View File

@@ -0,0 +1,402 @@
<?php
function create_color_control( $args, $wp_customize ) {
$wp_customize->add_setting(
$args['setting'], array(
'default' => $args['default'],
'transport' => 'refresh'
)
);
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize,
$args['setting'],
array(
'label' => $args['label'],
'description' => $args['description'],
'section' => $args['section'],
'settings' => $args['setting'],
'active_callback' => $args['active_callback']
)
)
);
}
/* =============================================== */
// # COLORS SECTION
/* =============================================== */
$wp_customize->add_section( 'colors_section', array(
'priority' => 10,
'capability' => 'edit_theme_options',
'theme_supports' => '',
'title' => __( 'Colors', 'yuzu' ),
'description' => '',
'panel' => 'theme_settings',
) );
/* =============================================== */
// ## Scheme
/* =============================================== */
$wp_customize->add_control(
new yuzu_Customizer_Accordion(
$wp_customize,
'yuzu-color-sheme-accordion',
array(
'section' => 'colors_section',
'label' => __( 'Color Scheme', 'yuzu' ),
'type' => 'accordion'
)
)
);
$wp_customize->add_setting( 'color_scheme', array(
'default' => 'light',
'transport' => 'refresh',
'sanitize_callback' => 'sanitize_text_field',
) );
$wp_customize->add_control(
'color_scheme',
array(
'type' => 'radio',
'label' => __('Color Scheme', 'yuzu'),
'section' => 'colors_section',
'choices' => array(
'light' => __('Light Theme (default)', 'yuzu'),
'dark' => __('Dark Theme', 'yuzu'),
'custom' => __('Custom Theme', 'yuzu'),
)
)
);
function is_custom_scheme_callback( $control ) {
if ( $control->manager->get_setting('color_scheme')->value() == 'custom' ) {
return true;
} else {
return false;
}
}
/* =============================================== */
// ## Backgrounds
/* =============================================== */
$wp_customize->add_control(
new yuzu_Customizer_Accordion(
$wp_customize,
'yuzu-backgrounds-colors-accordion',
array(
'section' => 'colors_section',
'label' => __( 'Backgrounds', 'yuzu' ),
'type' => 'accordion'
)
)
);
$wp_customize->add_setting( 'bg_not_editable_notice',
array(
'default' => '',
'transport' => 'postMessage',
'sanitize_callback' => 'skyrocket_text_sanitization'
)
);
$wp_customize->add_control( new Skyrocket_Simple_Notice_Custom_control( $wp_customize, 'bg_not_editable_notice',
array(
'label' => __( 'Unavailable', 'yuzu' ),
'description' => __('Please select "Custom Scheme" in order to be able to edit colors individually.', 'yuzu' ),
'section' => 'colors_section',
'active_callback' => function(){
if(get_theme_mod( 'color_scheme', 'light' ) != 'custom')
return true;
}
)
) );
$args = array(
'setting' => 'top_bar_bg',
'section' => 'colors_section',
'label' => 'Top Bar Background',
'description' => '',
'default' => '#FFF',
'active_callback' => 'is_custom_scheme_callback'
);
create_color_control( $args, $wp_customize );
$args = array(
'setting' => 'body_bg',
'section' => 'colors_section',
'label' => 'Body Background',
'description' => '',
'default' => '#FAFBFB',
'active_callback' => 'is_custom_scheme_callback'
);
create_color_control( $args, $wp_customize );
$args = array(
'setting' => 'footer_bg',
'section' => 'colors_section',
'label' => 'Footer Background',
'description' => '',
'default' => '#F6F7FB',
'active_callback' => 'is_custom_scheme_callback'
);
create_color_control( $args, $wp_customize );
$args = array(
'setting' => 'card_bg',
'section' => 'colors_section',
'label' => 'Cards Background',
'description' => '',
'default' => '#F6F7FB',
'active_callback' => 'is_custom_scheme_callback'
);
create_color_control( $args, $wp_customize );
$args = array(
'setting' => 'search_widget_bg',
'section' => 'colors_section',
'label' => 'Search Field Background',
'description' => '',
'default' => '#f5f4f4',
'active_callback' => 'is_custom_scheme_callback'
);
create_color_control( $args, $wp_customize );
$args = array(
'setting' => 'comment_bg',
'section' => 'colors_section',
'label' => 'Comment Background',
'description' => '',
'default' => '#F6F7FB',
'active_callback' => 'is_custom_scheme_callback'
);
create_color_control( $args, $wp_customize );
$args = array(
'setting' => 'comment_form_bg',
'section' => 'colors_section',
'label' => 'Comment Form Background',
'description' => '',
'default' => '#F6F7FB',
'active_callback' => 'is_custom_scheme_callback'
);
create_color_control( $args, $wp_customize );
/* =============================================== */
// ## Texts
/* =============================================== */
$wp_customize->add_control(
new yuzu_Customizer_Accordion(
$wp_customize,
'yuzu-text-colors-accordion',
array(
'section' => 'colors_section',
'label' => __( 'Font Colors', 'yuzu' ),
'type' => 'accordion'
)
)
);
$wp_customize->add_setting( 'color_not_editable_notice',
array(
'default' => '',
'transport' => 'postMessage',
'sanitize_callback' => 'skyrocket_text_sanitization'
)
);
$wp_customize->add_control( new Skyrocket_Simple_Notice_Custom_control( $wp_customize, 'color_not_editable_notice',
array(
'label' => __( 'Unavailable', 'yuzu' ),
'description' => __('Please select "Custom Scheme" in order to be able to edit colors individually.', 'yuzu' ),
'section' => 'colors_section',
'active_callback' => function(){
if(get_theme_mod( 'color_scheme', 'light' ) != 'custom')
return true;
}
)
) );
$args = array(
'setting' => 'link_color',
'section' => 'colors_section',
'label' => 'Link Color',
'description' => '',
'default' => '#4B828E',
'active_callback' => 'is_custom_scheme_callback'
);
create_color_control( $args, $wp_customize );
$args = array(
'setting' => 'link_hover_color',
'section' => 'colors_section',
'label' => 'Hovered Link Color',
'description' => '',
'default' => '#39636D',
'active_callback' => 'is_custom_scheme_callback'
);
create_color_control( $args, $wp_customize );
$args = array(
'setting' => 'top_bar_color',
'section' => 'colors_section',
'label' => 'Top Bar Color',
'description' => '',
'default' => '#2E3B4F',
'active_callback' => 'is_custom_scheme_callback',
);
create_color_control( $args, $wp_customize );
$args = array(
'setting' => 'body_color',
'section' => 'colors_section',
'label' => 'Body Color',
'description' => '',
'default' => '#2E3B4F',
'active_callback' => 'is_custom_scheme_callback'
);
create_color_control( $args, $wp_customize );
$args = array(
'setting' => 'footer_color',
'section' => 'colors_section',
'label' => 'Footer Color',
'description' => '',
'default' => '#2E3B4F',
'active_callback' => 'is_custom_scheme_callback'
);
create_color_control( $args, $wp_customize );
$args = array(
'setting' => 'card_color',
'section' => 'colors_section',
'label' => 'Cards Color',
'description' => '',
'default' => '#2E3B4F',
'active_callback' => 'is_custom_scheme_callback'
);
create_color_control( $args, $wp_customize );
$args = array(
'setting' => 'search_widget_color',
'section' => 'colors_section',
'label' => 'Search Field Color',
'description' => '',
'default' => '#2E3B4F',
'active_callback' => 'is_custom_scheme_callback'
);
create_color_control( $args, $wp_customize );
$args = array(
'setting' => 'comment_color',
'section' => 'colors_section',
'label' => 'Comment Color',
'description' => '',
'default' => '#2E3B4F',
'active_callback' => 'is_custom_scheme_callback'
);
create_color_control( $args, $wp_customize );
$args = array(
'setting' => 'comment_form_color',
'section' => 'colors_section',
'label' => 'Comment Form Color',
'description' => '',
'default' => '#2E3B4F',
'active_callback' => 'is_custom_scheme_callback'
);
create_color_control( $args, $wp_customize );
/* =============================================== */
// ## Others
/* =============================================== */
$wp_customize->add_control(
new yuzu_Customizer_Accordion(
$wp_customize,
'yuzu-other-colors-accordion',
array(
'section' => 'colors_section',
'label' => __( 'Others', 'yuzu' ),
'type' => 'accordion'
)
)
);
$wp_customize->add_setting( 'other_not_editable_notice',
array(
'default' => '',
'transport' => 'postMessage',
'sanitize_callback' => 'skyrocket_text_sanitization'
)
);
$wp_customize->add_control( new Skyrocket_Simple_Notice_Custom_control( $wp_customize, 'other_not_editable_notice',
array(
'label' => __( 'Unavailable', 'yuzu' ),
'description' => __('Please select "Custom Scheme" in order to be able to edit colors individually.', 'yuzu' ),
'section' => 'colors_section',
'active_callback' => function(){
if(get_theme_mod( 'color_scheme', 'light' ) != 'custom')
return true;
}
)
) );
$args = array(
'setting' => 'tag_color',
'section' => 'colors_section',
'label' => 'Tags Color',
'description' => '',
'default' => '#4B828E',
'active_callback' => 'is_custom_scheme_callback'
);
create_color_control( $args, $wp_customize );
$args = array(
'setting' => 'tag_hover_color',
'section' => 'colors_section',
'label' => 'Hovered Tag Color',
'description' => '',
'default' => '#39636D',
'active_callback' => 'is_custom_scheme_callback'
);
create_color_control( $args, $wp_customize );
$args = array(
'setting' => 'read_more_btn_bg',
'section' => 'colors_section',
'label' => 'Read More Button Background',
'description' => '',
'default' => '#F5F5F5',
'active_callback' => 'is_custom_scheme_callback'
);
create_color_control( $args, $wp_customize );
$args = array(
'setting' => 'read_more_btn_color',
'section' => 'colors_section',
'label' => 'Read More Button Color',
'description' => '',
'default' => '#2E3B4F',
'active_callback' => 'is_custom_scheme_callback'
);
create_color_control( $args, $wp_customize );
$args = array(
'setting' => 'post_comment_btn_bg',
'section' => 'colors_section',
'label' => 'Post Comment Button Background',
'description' => '',
'default' => '#F5F5F5',
'active_callback' => 'is_custom_scheme_callback'
);
create_color_control( $args, $wp_customize );
$args = array(
'setting' => 'post_comment_btn_color',
'section' => 'colors_section',
'label' => 'Post Comment Button Color',
'description' => '',
'default' => '#2E3B4F',
'active_callback' => 'is_custom_scheme_callback'
);
create_color_control( $args, $wp_customize );