要执行先要加载fontawesome到网站,记得要同时下载fonts文件夹,这些是svg的样式。
How to Add More Social Networks
Method 1: Using the Filter (Recommended)
Add this to your theme’s functions.php
after the main code:
// Add custom social networks
function add_more_social_networks($networks) {
// Add Clubhouse
$networks['clubhouse_url'] = array(
'label' => 'Clubhouse',
'icon' => 'fas fa-microphone',
'placeholder' => 'https://clubhouse.com/@username',
'color' => '#F1C65B'
);
// Add Twitch
$networks['twitch_url'] = array(
'label' => 'Twitch',
'icon' => 'fab fa-twitch',
'placeholder' => 'https://twitch.tv/username',
'color' => '#9146ff'
);
// Add Medium
$networks['medium_url'] = array(
'label' => 'Medium',
'icon' => 'fab fa-medium',
'placeholder' => 'https://medium.com/@username',
'color' => '#00ab6c'
);
// Add Reddit
$networks['reddit_url'] = array(
'label' => 'Reddit',
'icon' => 'fab fa-reddit',
'placeholder' => 'https://reddit.com/u/username',
'color' => '#ff4500'
);
return $networks;
}
add_filter('social_networks_config', 'add_more_social_networks');
Method 2: Direct Modification
Simply edit the get_social_networks_config()
function and add more entries to the array.
Key Features of This Dynamic System:
✅ Already Included Networks:
- LinkedIn Profile (
linkedin_url
) - LinkedIn Company (
linkedin_company_url
) - Twitter/X
- TikTok ✅
- YouTube
- GitHub
- Dribbble
- Behance
- Snapchat
- Discord
- Telegram
- Website
✅ Advanced Features:
- Dynamic Form Generation – All fields auto-generated from config
- Visual Icons – Each field shows the appropriate icon with brand colors
- Smart URL Validation – Handles different URL formats
- Email Support – Automatically converts emails to
mailto:
links - Responsive Design – Works on all devices
- Developer Friendly – Easy to extend with filters
- Admin Enhancement – Loads FontAwesome in admin area
✅ Usage Examples:
// Display current author's social icons
the_author_social_icons();
// Display specific user's icons
display_user_social_icons(123);
// Check if user has social links
if (user_has_social_links(123)) {
echo "User has " . get_user_social_count(123) . " social links";
}
// Get specific social URL
$tiktok = get_user_social_url(123, 'tiktok');
✅ Shortcode Usage:
[social_icons]
[social_icons user_id="123"]
[social_icons show_empty="true"]
点击下面按钮下载文件: