get_section( $section_id ); // Set Site Title & Tagline section priority //$section->priority = 10250; // Re-prioritize and rename the Widgets panel if ( ! isset( $wp_customize->get_panel( 'widgets' )->priority ) ) $wp_customize->add_panel( 'widgets' ); $wp_customize->get_panel( 'widgets' )->priority = 11900; $wp_customize->get_panel( 'widgets' )->title = __( 'Active Widget Areas (WP)', 'absolute-weaver' ) . ABSOLUTE_WVR_REFRESH_ICON; // Re-prioritize and rename the Menus panel if ( ! isset( $wp_customize->get_panel( 'nav_menus' )->priority ) ) $wp_customize->add_panel( 'nav_menus' ); $wp_customize->get_panel( 'nav_menus' )->priority = 11910; $wp_customize->get_panel( 'nav_menus' )->title = __( 'Custom Menus Content (WP)', 'absolute-weaver' ) . ABSOLUTE_WVR_REFRESH_ICON; // Remove WP Background Color control $wp_customize->remove_control( 'background_color' ); } function aweaver_customize_preview_js() { // @@@ possibly add Loading message.... WeaverA_Restore_WV_Settings::controls_print_scripts(); aweaver_check_customizer_memory(); } add_action('customize_controls_print_footer_scripts', 'aweaver_customize_preview_js'); /* * Customizer scripts */ function aweaver_enqueue_customizer_scripts(){ // Styles wp_enqueue_style( 'weavera-customizer-jquery-ui', get_template_directory_uri() . '/admin/customizer/css/jquery-ui/jquery-ui-1.10.4.custom.css', array(), '1.10.4' ); wp_enqueue_style( 'weavera-customizer-chosen', get_template_directory_uri() . '/admin/customizer/css/chosen/chosen.css', array(), '1.3.0' ); wp_enqueue_style( 'weavera-customizer-sections', get_template_directory_uri() . "/admin/customizer/css/customizer-sections".ABSOLUTE_WVR_MINIFY.".css", array( 'weavera-customizer-jquery-ui', 'weavera-customizer-chosen' ), ABSOLUTE_WVR_VERSION ); // stylesheet for customizer wp_enqueue_style( 'dashicons' ); // Scripts wp_enqueue_script( 'aweaver-customizer-chosen', get_template_directory_uri() . '/admin/customizer/js/chosen.jquery.js', array( 'jquery', 'customize-controls' ), '1.3.0', true ); wp_enqueue_script( 'aweaver-customizer-sections', get_template_directory_uri() . '/admin/customizer/js/customizer-sections' . ABSOLUTE_WVR_MINIFY . '.js', array( 'jquery','customize-controls', 'aweaver-customizer-chosen' ), ABSOLUTE_WVR_VERSION, true ); // Save/Restore scripts WeaverA_Save_WV_Settings::enqueue_scripts(); // WeaverA_Restore_WV_Settings::enqueue_scripts(); } add_action('customize_save', 'aweaver_cz_save'); function aweaver_cz_save($class) { //aweaver_save_opts('customizer', true); // have to save things - generate css setting and file, for example. } add_action('customize_save_after', 'aweaver_cz_save_after'); function aweaver_cz_save_after($class) { aweaver_save_opts('customizer', true); // have to save things - generate css setting and file, for example. } if ( ! function_exists( 'aweaver_customizer_get_panels' ) ) : /** * Return an array of panel definitions. * * @since 1.3.0. * @return array The array of panel definitions. */ function aweaver_customizer_get_panels() { $panels = array( 'starting' => array( 'title' => __( 'Absolute Weaver: Start Here', 'absolute-weaver' ), 'priority' => 10100, 'description' => __( "How to get started with Absolute Weaver." , 'absolute-weaver' )), 'general' => array( 'title' => __( 'General Options & Admin', 'absolute-weaver' ), 'priority' => 10200, 'description' => __( "General settings: Site Identity, Static Front Page, Admin Options, Help" , 'absolute-weaver' )), 'layout' => array( 'title' => __( 'Layout', 'absolute-weaver' ), 'priority' => 10300, 'description' => __( "Layout controls the overall look of your site. This includes sidebar and widget area layout, content and post display layout, and menu layout." , 'absolute-weaver' ) ), 'typography' => array( 'title' => __( 'Typography', 'absolute-weaver' ), 'priority' => 10400, 'description' => __( "Typography: font family, font size, bold, italic." , 'absolute-weaver' )), 'images' => array( 'title' => __( 'Images', 'absolute-weaver' ), 'priority' => 10500, 'description' => __( "Image Options: borders, placement, Featured Images, Header Images, Background Images." , 'absolute-weaver' ) ), 'visibility' => array( 'title' => __( 'Visibility', 'absolute-weaver' ), 'priority' => 10600, 'description' => __( "Specify visibility - hide various elements on various devices (desktop, tablets, phones)." , 'absolute-weaver' ) ), 'site-colors' => array( 'title' => __( 'Colors', 'absolute-weaver' ), 'priority' => 10700, 'description' => __( "Specify all colors used on site - both text and background colors. TIP: Clicking Default on the color picker will restore the original color set when you loaded the Customizer." , 'absolute-weaver' )), 'spacing' => array( 'title' => __( 'Spacing, Widths, Alignment', 'absolute-weaver' ), 'priority' => 10800, 'description' => __( "Set margins, padding, spacing, heights, and widths." , 'absolute-weaver' ) ), 'style' => array( 'title' => __( 'Style (borders, etc.)', 'absolute-weaver' ), 'priority' => 10900, 'description' => __( "Style: borders, shadows, rounded corners, list bullet style, icons. (Important note: using rounded corners usually requires specifying a BG color or border.)" , 'absolute-weaver' ) ), 'content' => array( 'title' => __( 'Added Content (HTML Areas...)', 'absolute-weaver' ), 'priority' => 11000, 'description' => __( "Specify added content: Define added content for HTML areas." , 'absolute-weaver' ) ), 'custom' => array( 'title' => __( 'Custom CSS', 'absolute-weaver' ), 'priority' => 11100, 'description' => __( 'Define Global rules for whole site.' , 'absolute-weaver' ) ), 'page-builder' => array( 'title' => __( 'Page Builders', 'absolute-weaver' ), 'priority' => 11200, 'description' => __( 'Options for integration with Page Builders.' , 'absolute-weaver' ) ), ); /** * Filter the array of panel definitions for the Customizer. * * @since 1.3.0. * * @param array $panels The array of panel definitions. */ return $panels; } endif; if ( ! function_exists( 'aweaver_customizer_add_panels' ) ) : /** * Register Customizer panels */ function aweaver_customizer_add_panels( $wp_customize ) { $theme_prefix = 'aweaver_'; // Get panel definitions $panels = aweaver_customizer_get_panels(); // Add panels foreach ( $panels as $panel => $data ) { // Add panel if (!empty($data)) $wp_customize->add_panel( $theme_prefix . $panel, $data ); } } endif; if ( ! function_exists( 'aweaver_customizer_get_sections' ) ) : /** * Return the master array of Customizer sections * * @since 1.3.0. * * @return array The master array of Customizer sections */ function aweaver_customizer_get_sections() { // Add all the section definitions $pb = aweaver_customizer_define_pagebuilder_sections(); $content = aweaver_customizer_define_content_sections(); // get array for each section $custom = aweaver_customizer_define_custom_sections(); $general = aweaver_customizer_define_general_sections(); $image = aweaver_customizer_define_image_sections(); $layout = aweaver_customizer_define_layout_sections(); $colorscheme = aweaver_customizer_define_colorscheme_sections(); $spacing = aweaver_customizer_define_spacing_sections(); $starting = aweaver_customizer_define_starting_sections(); $style = aweaver_customizer_define_style_sections(); $typography = aweaver_customizer_define_typography_sections(); $visibility = aweaver_customizer_define_visibility_sections(); return array_merge($pb, $content, $custom, $general, $image, $layout, $colorscheme, $spacing, $starting, $style, $typography, $visibility ); // merge the arrays } endif; if ( ! function_exists( 'aweaver_customizer_add_sections' ) ) : /** * Add sections and controls to the customizer. * * Hooked to 'customize_register' via aweaver_customizer_init(). * * @since 1.0.0. * * @param WP_Customize_Manager $wp_customize Theme Customizer object. * @return void */ function aweaver_customizer_add_sections( $wp_customize ) { $theme_prefix = 'aweaver_'; $default_path = get_template_directory() . '/admin/customizer/sections'; $panels = aweaver_customizer_get_panels(); // Load section definition files foreach ( $panels as $panel => $data ) { $file = trailingslashit( $default_path ) . $panel . '.php'; if ( file_exists( $file ) ) { require_once( $file ); } } // Compile the section definitions $sections = aweaver_customizer_get_sections(); // Register each section and add its options $priority = array(); foreach ( $sections as $section => $data ) { // Get the non-prefixed ID of the current section's panel $panel = ( isset( $data['panel'] ) ) ? str_replace( $theme_prefix, '', $data['panel'] ) : 'none'; // Store the options if ( isset( $data['options'] ) ) { $options = $data['options']; unset( $data['options'] ); } // Determine the priority if ( ! isset( $data['priority'] ) ) { $panel_priority = ( 'none' !== $panel && isset( $panels[ $panel ]['priority'] ) ) ? $panels[ $panel ]['priority'] : 1000; // Create a separate priority counter for each panel, and one for sections without a panel if ( ! isset( $priority[ $panel ] ) ) { $priority[ $panel ] = new aweaver_cz_Prioritizer( $panel_priority, 10 ); } $data['priority'] = $priority[ $panel ]->add(); } // Register section $wp_customize->add_section( $theme_prefix . $section, $data ); // Add options to the section if ( isset( $options ) ) { aweaver_customizer_add_section_options( $theme_prefix . $section, $options ); unset( $options ); } } } endif; function aweaver_cz_settings_name($id) { $theme_opts = ABSOLUTE_WVR_SETTINGS_NAME; //apply_filters('aweaver_options','absolute_wvr_settingszzz'); return $theme_opts . '['. $id . ']'; //return $id; } if ( ! function_exists( 'aweaver_customizer_add_section_options' ) ) : /** * Register settings and controls for a section. */ function aweaver_customizer_add_section_options( $section, $args, $initial_priority = 100 ) { global $wp_customize; $priority = new aweaver_cz_Prioritizer( $initial_priority, 5 ); $theme_prefix = 'aweaver_'; foreach ( $args as $setting_id => $option ) { if ( isset( $option['setting'] ) ) { $defaults = array( 'type' => ABSOLUTE_WVR_CUSTOMIZER_TYPE, //'option' or 'theme_mod' 'capability' => 'edit_theme_options', 'theme_supports' => '', 'default' => false, 'transport' => 'refresh', 'sanitize_callback' => ABSOLUTE_WVR_DEFAULT_SANITIZE, 'sanitize_js_callback' => '', ); $setting = wp_parse_args( $option['setting'], $defaults ); // Add the setting arguments in array to add_setting call so Theme Check can verify the presence of sanitize_callback $wp_customize->add_setting( new WP_Customize_Setting( $wp_customize, aweaver_cz_settings_name( $setting_id ), array( 'type' => $setting['type'], 'capability' => $setting['capability'], 'theme_supports' => $setting['theme_supports'], 'default' => $setting['default'], 'transport' => $setting['transport'], 'sanitize_callback' => $setting['sanitize_callback'], 'sanitize_js_callback' => $setting['sanitize_js_callback'], ) )); } // Add control if ( isset( $option['control'] ) ) { $control_id = $theme_prefix . $setting_id; $defaults = array( 'section' => $section, 'priority' => $priority->add(), 'settings' => aweaver_cz_settings_name( $setting_id ), ); if ( ! isset( $option['setting'] ) ) { unset( $defaults['settings'] ); } $control = wp_parse_args( $option['control'], $defaults ); // Check for a specialized control class - create new instance if ( isset( $control['control_type'] ) ) { $class = $control['control_type']; if ( class_exists( $class ) ) { unset( $control['control_type'] ); // Dynamically generate a new class instance $class_instance = new $class( $wp_customize, $control_id, $control ); $wp_customize->add_control( $class_instance ); } else { if ( ABSOLUTE_WVR_DEV_MODE ) { echo '