function raindrops_data_store_relate_id($id) { if ('option' == raindrops_theme_mod($id, 'data_type')) { return THEME_OPTION_FIELD_NAME . '[' . $id . ']'; } return $id; }
function raindrops_extend_customize_register($wp_customize) { global $raindrops_theme_customize_sections, $raindrops_customize_args, $raindrops_theme_customize_panels; /** * Create Section */ foreach ($raindrops_theme_customize_sections as $raindrops_section_key => $raindrops_section_val) { $wp_customize->add_section($raindrops_section_key, $raindrops_section_val); } /** * Create Panel */ foreach ($raindrops_theme_customize_panels as $raindrops_panel_key => $raindrops_panel_val) { $wp_customize->add_panel($raindrops_panel_key, $raindrops_panel_val); } /** * Create Default Controls */ foreach ($raindrops_customize_args as $key => $raindrops_mod_val) { if (!isset($raindrops_customize_args[$key]['extend_customize_setting']) || empty($raindrops_customize_args[$key]['extend_customize_setting'])) { $id = raindrops_data_store_relate_id($key); $wp_customize->add_setting($id, array('default' => $raindrops_customize_args[$key]['default'], 'type' => $raindrops_customize_args[$key]['data_type'], 'capability' => $raindrops_customize_args[$key]['capability'], 'sanitize_callback' => $raindrops_customize_args[$key]['sanitize_callback'], 'sanitize_js_callback' => $raindrops_customize_args[$key]['sanitize_js_callback'], 'theme_supports' => $raindrops_customize_args[$key]['theme_supports'], 'transport' => $raindrops_customize_args[$key]['transport'], 'dirty' => $raindrops_customize_args[$key]['dirty'])); } if (!isset($raindrops_customize_args[$key]['extend_customize_control']) || empty($raindrops_customize_args[$key]['extend_customize_control'])) { $id = raindrops_data_store_relate_id($key); $wp_customize->add_control($id, array('label' => $raindrops_customize_args[$key]['label'], 'section' => $raindrops_customize_args[$key]['section'], 'settings' => $id, 'type' => $raindrops_customize_args[$key]['type'], 'choices' => $raindrops_customize_args[$key]['choices'], 'active_callback' => $raindrops_customize_args[$key]['active_callback'], 'priority' => $raindrops_customize_args[$key]['priority'], 'input_attrs' => $raindrops_customize_args[$key]['input_attrs'], 'description' => $raindrops_customize_args[$key]['description'], 'json' => $raindrops_customize_args[$key]['json'])); } } /** * Create Custom Control */ // check $settings = 'raindrops_base_color'; $key = raindrops_data_store_relate_id($settings); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, $key, array('label' => raindrops_theme_mod($settings, 'label'), 'section' => raindrops_theme_mod($settings, 'section'), 'settings' => $key, 'active_callback' => raindrops_theme_mod($settings, 'active_callback'), 'priority' => raindrops_theme_mod($settings, 'priority')))); // check $settings = 'raindrops_default_fonts_color'; $key = raindrops_data_store_relate_id($settings); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, $key, array('label' => raindrops_theme_mod($settings, 'label'), 'section' => raindrops_theme_mod($settings, 'section'), 'settings' => $key, 'active_callback' => raindrops_theme_mod($settings, 'active_callback'), 'priority' => raindrops_theme_mod($settings, 'priority')))); $settings = 'raindrops_hyperlink_color'; $key = raindrops_data_store_relate_id($settings); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, $key, array('label' => raindrops_theme_mod($settings, 'label'), 'section' => raindrops_theme_mod($settings, 'section'), 'settings' => $key, 'priority' => raindrops_theme_mod($settings, 'priority')))); $settings = 'raindrops_footer_color'; $key = raindrops_data_store_relate_id($settings); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, $key, array('label' => raindrops_theme_mod($settings, 'label'), 'section' => raindrops_theme_mod($settings, 'section'), 'settings' => $key, 'active_callback' => raindrops_theme_mod($settings, 'active_callback'), 'priority' => raindrops_theme_mod($settings, 'priority')))); $settings = 'raindrops_footer_link_color'; $key = raindrops_data_store_relate_id($settings); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, $key, array('label' => raindrops_theme_mod($settings, 'label'), 'section' => raindrops_theme_mod($settings, 'section'), 'settings' => $key, 'active_callback' => raindrops_theme_mod($settings, 'active_callback'), 'priority' => raindrops_theme_mod($settings, 'priority')))); $settings = 'raindrops_header_image_filter_color'; $key = raindrops_data_store_relate_id($settings); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, $key, array('label' => raindrops_theme_mod($settings, 'label'), 'section' => raindrops_theme_mod($settings, 'section'), 'settings' => $key, 'active_callback' => raindrops_theme_mod($settings, 'active_callback'), 'priority' => raindrops_theme_mod($settings, 'priority')))); /** * Exstra Menu */ $wp_customize->add_setting('raindrops_changelog_setting', array('default' => '', 'type' => '', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'esc_html')); $wp_customize->add_control(new Raindrops_Customize_Changelog_Control($wp_customize, 'raindrops_changelog_setting', array('label' => esc_html__('Change Log', 'raindrops'), 'description' => esc_html__('Most Recent Changes', 'raindrops'), 'section' => 'raindrops_theme_settings_document', 'settings' => 'raindrops_changelog_setting'))); $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'header_textcolor', array('label' => __('Header Text Color', 'raindrops'), 'section' => 'title_tagline', 'priority' => 10))); $wp_customize->remove_control('display_header_text'); }