settings_previewed example

foreach ( $incoming_setting_ids as $setting_id ) {
            if ( ! is_null( $this->get_setting_type( $setting_id ) ) ) {
                $widget_setting_ids[] = $setting_id;
            }
        }
        if ( $this->manager->doing_ajax( 'update-widget' ) && isset( $_REQUEST['widget-id'] ) ) {
            $widget_setting_ids[] = $this->get_setting_id( wp_unslash( $_REQUEST['widget-id'] ) );
        }

        $settings = $this->manager->add_dynamic_settings( array_unique( $widget_setting_ids ) );

        if ( $this->manager->settings_previewed() ) {
            foreach ( $settings as $setting ) {
                $setting->preview();
            }
        }
    }

    /** * Determines the arguments for a dynamically-created setting. * * @since 4.2.0 * * @param false|array $args The arguments to the WP_Customize_Setting constructor. * @param string $setting_id ID for dynamic setting, usually coming from `$_POST['customized']`. * @return array|false Setting arguments, false otherwise. */
public function customize_register() {
        $changeset = $this->manager->unsanitized_post_values();

        // Preview settings for nav menus early so that the sections and controls will be added properly.         $nav_menus_setting_ids = array();
        foreach ( array_keys( $changeset ) as $setting_id ) {
            if ( preg_match( '/^(nav_menu_locations|nav_menu|nav_menu_item)\[/', $setting_id ) ) {
                $nav_menus_setting_ids[] = $setting_id;
            }
        }
        $settings = $this->manager->add_dynamic_settings( $nav_menus_setting_ids );
        if ( $this->manager->settings_previewed() ) {
            foreach ( $settings as $setting ) {
                $setting->preview();
            }
        }

        // Require JS-rendered control types.         $this->manager->register_panel_type( 'WP_Customize_Nav_Menus_Panel' );
        $this->manager->register_control_type( 'WP_Customize_Nav_Menu_Control' );
        $this->manager->register_control_type( 'WP_Customize_Nav_Menu_Name_Control' );
        $this->manager->register_control_type( 'WP_Customize_Nav_Menu_Locations_Control' );
        $this->manager->register_control_type( 'WP_Customize_Nav_Menu_Auto_Add_Control' );
        
$this->register_control_type( 'WP_Customize_Date_Time_Control' );

        /** * Fires once WordPress has loaded, allowing scripts and styles to be initialized. * * @since 3.4.0 * * @param WP_Customize_Manager $manager WP_Customize_Manager instance. */
        do_action( 'customize_register', $this );

        if ( $this->settings_previewed() ) {
            foreach ( $this->settings as $setting ) {
                $setting->preview();
            }
        }

        if ( $this->is_preview() && ! is_admin() ) {
            $this->customize_preview_init();
        }
    }

    /** * Prevents Ajax requests from following redirects when previewing a theme * by issuing a 200 response instead of a 30x. * * Instead, the JS will sniff out the location header. * * @since 3.4.0 * @deprecated 4.7.0 * * @param int $status Status. * @return int */
Home | Imprint | This part of the site doesn't use cookies.