Created
October 7, 2021 09:02
-
-
Save awsm-support/11880485d33125f5efa7ae461b5884f9 to your computer and use it in GitHub Desktop.
Team Pro - Add Custom Icons with Popular Brand Icons Plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function awsm_team_member_custom_social_info( $social_info, $social ) { | |
if ( isset( $social['link'] ) && ! wp_http_validate_url( $social['link'] ) && substr_count( $social['link'], '#' ) >= 2 && substr( $social['link'], 0, 1 ) === '#' ) { | |
$link_arr = explode( '#', $social['link'] ); | |
$icon = $link_arr[1]; | |
$link = $link_arr[2]; | |
$is_framework_color = false; // change this to true if you want the default icon color. | |
$shortcode = sprintf( '[simple_icon name="%1$s" size="16px"%2$s]', esc_attr( $icon ), ! $is_framework_color ? ' color="black"' : '' ); | |
$social_info = sprintf( '<span><a href="%1$s" target="_blank">%2$s</a></span>', esc_url( 'https://' . $link ), do_shortcode( $shortcode ) ); | |
} | |
return $social_info; | |
} | |
add_filter( 'awsm_team_member_social_info', 'awsm_team_member_custom_social_info', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Result (Example)
Resources
How to Easily Add Custom Code to Your WordPress Websites