get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; /* $wp_customize->add_section( 'widely_social', array( 'title' => __( 'Social Accounts', 'widely' ), 'priority' => 80, ) ); // Add settings foreach ( widely_default_options() as $setting => $default ) { $wp_customize->add_setting( $setting, array( 'default' => $default, ) ); } $wp_customize->add_control( 'twitter', array( 'label' => __( 'Twitter Username', 'widely' ), 'section' => 'widely_social', 'settings' => 'twitter', 'type' => 'text', ) ); $wp_customize->add_control( 'facebook', array( 'label' => __( 'Facebook URL', 'widely' ), 'section' => 'widely_social', 'settings' => 'facebook', 'type' => 'text', ) ); $wp_customize->add_control( 'linkedin', array( 'label' => __( 'LinkedIn URL', 'widely' ), 'section' => 'widely_social', 'settings' => 'linkedin', 'type' => 'text', ) ); $wp_customize->add_control( 'google_plus', array( 'label' => __( 'Google+ URL', 'widely' ), 'section' => 'widely_social', 'settings' => 'google_plus', 'type' => 'text', ) ); */ } add_action( 'customize_register', 'widely_customize_register' ); /** * Sanitize and validate form input. Accepts an array, return a sanitized array. * * @param array $input Unknown values. * @return array Sanitized theme options ready to be stored in the database. * * @since Widely 2.0.1-wpcom */ function widely_sanitize_options( $input ) { $output = $defaults = widely_default_options(); // Twitter if ( isset( $input['twitter'] ) && ! empty( $input['twitter'] ) ) { $output['twitter'] = trim( wp_kses( $input['twitter'], array() ) ); $output['twitter'] = str_replace( array( 'http://twitter.com/', '/', '@', '#!', ), array( '', '', '', '', ), $output['twitter'] ); delete_transient( 'widely-twitter' ); delete_transient( 'widely-twitter-error' ); } // URLs must be a safe for database usage if ( isset( $input['facebook'] ) && ! empty( $input['facebook'] ) ) $output['facebook'] = esc_url_raw( $input['facebook'] ); if ( isset( $input['linkedin'] ) && ! empty( $input['linkedin'] ) ) $output['linkedin'] = esc_url_raw( $input['linkedin'] ); if ( isset( $input['google_plus'] ) && ! empty( $input['google_plus'] ) ) $output['google_plus'] = esc_url_raw( $input['google_plus'] ); return apply_filters( 'widely_sanitize_options', $output, $input, $defaults ); } add_filter( 'sanitize_option_theme_mods_widely', 'widely_sanitize_options', 10, 2 ); /** * Returns the default options array for Widely. * * @return array * * @since Widely 2.0.1-wpcom */ function widely_default_options() { $defaults = array( 'twitter' => '', 'facebook' => '', 'linkedin' => '', 'google_plus' => '', ); return apply_filters( 'widely_default_options', $defaults ); }