add_section( 'buzzo_social', array( 'title' => __( 'Social network', 'buzzo' ), 'priority' => 85, ) ); foreach ( $social_settings as $key => $value ) { $wp_customize->add_setting( 'buzzo_social[' . $key . ']', array( 'default' => '', 'transport' => 'refresh', 'sanitize_callback' => 'esc_url', ) ); $wp_customize->add_control( 'buzzo_social[' . $key . ']', array( 'label' => $value, 'section' => 'buzzo_social', 'type' => 'text', ) ); } /* $wp_customize->add_section( 'buzzo_social_sharing', array( 'title' => __( 'Social sharing', 'buzzo' ), 'priority' => 85, ) ); $wp_customize->add_setting( 'buzzo_social_sharing_sc', array( 'default' => '', 'transport' => 'refresh', 'sanitize_callback' => 'sanitize_text_field', ) ); $wp_customize->add_control( 'buzzo_social_sharing_sc', array( 'label' => __( 'Post sharing shortcode', 'buzzo' ), 'section' => 'buzzo_social_sharing', 'type' => 'text', 'description' => __( 'Allow filling 3rd plugin shortcode to display post sharing.', 'buzzo' ), ) ); */ } } new Buzzo_Social(); /** * Get socials name. * * @return array */ function buzzo_get_social_settings() { return apply_filters( 'buzzo_social_settings', array( 'twitter' => __( 'Twitter', 'buzzo' ), 'github' => __( 'Github', 'buzzo' ), 'wordpress' => __( 'WordPress', 'buzzo' ), 'youtube' => __( 'Youtube', 'buzzo' ), 'facebook' => __( 'Facebook', 'buzzo' ), 'dribbble' => __( 'Dribbble', 'buzzo' ), 'digg' => __( 'Digg', 'buzzo' ), 'deviantart' => __( 'Deviantart', 'buzzo' ), 'flickr' => __( 'Flickr', 'buzzo' ), 'google-plus' => __( 'Google plus', 'buzzo' ), 'instagram' => __( 'Instagram', 'buzzo' ), 'pinterest' => __( 'Pinterest', 'buzzo' ), 'vimeo' => __( 'Vimeo', 'buzzo' ), ) ); } /** * Get socials icon. * * @return array */ function buzzo_get_social_icons() { return apply_filters( 'buzzo_social_icons', array( 'twitter' => 'fa fa-twitter', 'github' => 'fa fa-github', 'wordpress' => 'fa fa-wordpress', 'youtube' => 'fa fa-youtube', 'facebook' => 'fa fa-facebook', 'dribbble' => 'fa fa-dribbble', 'digg' => 'fa fa-digg', 'deviantart' => 'fa fa-deviantart', 'flickr' => 'fa fa-flickr', 'google-plus' => 'fa fa-google-plus', 'instagram' => 'fa fa-instagram', 'pinterest' => 'fa fa-pinterest', 'vimeo' => 'fa fa-vimeo', ) ); } if ( ! function_exists( 'buzzo_social_icons' ) ) : /** * Display socials icon. */ function buzzo_social_icons() { $social_settings = get_theme_mod( 'buzzo_social', array() ); $social_icons = buzzo_get_social_icons(); $output = ''; foreach ( $social_settings as $key => $value ) { if ( ! $value ) { continue; } $output .= sprintf( '', esc_url( $value ), isset( $social_icons[ $key ] ) ? esc_attr( $social_icons[ $key ] ) : '' ); } if ( empty( $output ) ) { return; } printf( '
%s
', wp_kses_post( $output ) ); } endif;