/** * Adding different options * * @param WP_Customize_Manager $wp_customize Theme Customizer object. */ function supermag_customize_register($wp_customize) { $wp_customize->get_setting('blogname')->transport = 'postMessage'; $wp_customize->get_setting('blogdescription')->transport = 'postMessage'; /*saved options*/ $options = supermag_get_theme_options(); /*defaults options*/ $defaults = supermag_get_default_theme_options(); /* * file for customizer custom controls classes */ $supermag_custom_controls_file_path = supermag_file_directory('acmethemes/customizer/custom-controls.php'); require $supermag_custom_controls_file_path; /* * file for feature panel of home page */ $supermag_customizer_feature_option_file_path = supermag_file_directory('acmethemes/customizer/feature-section/feature-panel.php'); require $supermag_customizer_feature_option_file_path; /* * file for header panel */ $supermag_customizer_header_options_file_path = supermag_file_directory('acmethemes/customizer/header-options/header-panel.php'); require $supermag_customizer_header_options_file_path; /* * file for customizer footer section */ $supermag_customizer_footer_options_file_path = supermag_file_directory('acmethemes/customizer/footer-section/footer-section.php'); require $supermag_customizer_footer_options_file_path; /* * file for design/layout panel */ $supermag_customizer_design_options_file_path = supermag_file_directory('acmethemes/customizer/design-options/design-panel.php'); require $supermag_customizer_design_options_file_path; /* * file for single post sections */ $supermag_customizer_single_post_section_file_path = supermag_file_directory('acmethemes/customizer/single-posts/single-post-section.php'); require $supermag_customizer_single_post_section_file_path; /* * file for options panel */ $supermag_customizer_options_panel_file_path = supermag_file_directory('acmethemes/customizer/options/options-panel.php'); require $supermag_customizer_options_panel_file_path; /* * file for options reset */ $supermag_customizer_options_reset_file_path = supermag_file_directory('acmethemes/customizer/options/options-reset.php'); require $supermag_customizer_options_reset_file_path; /*removing*/ $wp_customize->remove_panel('header_image'); $wp_customize->remove_control('header_textcolor'); }
function supermag_reset_setting_callback($input, $setting) { // Ensure input is a slug. $input = sanitize_text_field($input); if ('0' == $input) { return '0'; } $supermag_default_theme_options = supermag_get_default_theme_options(); $supermag_get_theme_options = get_theme_mod('supermag_theme_options'); switch ($input) { case "reset-color-options": $supermag_get_theme_options['supermag-primary-color'] = $supermag_default_theme_options['supermag-primary-color']; supermag_reset_db_options($supermag_get_theme_options); break; case "reset-all": supermag_reset_db_options($supermag_default_theme_options); break; default: break; } return '0'; }
function supermag_get_theme_options() { $supermag_default_theme_options = supermag_get_default_theme_options(); $supermag_get_theme_options = get_theme_mod('supermag_theme_options'); if (is_array($supermag_get_theme_options)) { return array_merge($supermag_default_theme_options, $supermag_get_theme_options); } else { return $supermag_default_theme_options; } }