Skip to content

Instantly share code, notes, and snippets.

@awsm-support
Created October 7, 2021 09:02
Show Gist options
  • Save awsm-support/11880485d33125f5efa7ae461b5884f9 to your computer and use it in GitHub Desktop.
Save awsm-support/11880485d33125f5efa7ae461b5884f9 to your computer and use it in GitHub Desktop.
Team Pro - Add Custom Icons with Popular Brand Icons Plugin
<?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 );
@awsm-support
Copy link
Author

awsm-support commented Oct 7, 2021

  1. Install and activate Popular Brand Icons – Simple Icons plugin.
  2. Add the code snippet in your child theme functions.php file, or you can use any of the code snippets management plugins (e.g., Code Snippets) to add the below code.

Screenshot 2021-10-07 at 2 19 43 PM

  1. Then, add the Link in team member content as #orcid# (copied from Settings > Simple Icons) followed by the URL without the https part. Then, save the changes. You can use the same method for adding other icons from the Popular Brand Icons plugin.

Screenshot 2021-10-07 at 2 49 24 PM

Screenshot 2021-10-07 at 2 36 27 PM

Result (Example)

Screenshot 2021-10-07 at 2 22 06 PM

Resources

How to Easily Add Custom Code to Your WordPress Websites

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment