星期二 , 27 5 月 2025

在wp网站部署社交链接的模块

要执行先要加载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:

  • Facebook
  • LinkedIn Profile (linkedin_url)
  • LinkedIn Company (linkedin_company_url)
  • Twitter/X
  • Instagram
  • TikTok
  • YouTube
  • GitHub
  • Dribbble
  • Behance
  • Pinterest
  • Snapchat
  • Discord
  • Telegram
  • WhatsApp
  • Website
  • Email

Advanced Features:

  1. Dynamic Form Generation – All fields auto-generated from config
  2. Visual Icons – Each field shows the appropriate icon with brand colors
  3. Smart URL Validation – Handles different URL formats
  4. Email Support – Automatically converts emails to mailto: links
  5. Responsive Design – Works on all devices
  6. Developer Friendly – Easy to extend with filters
  7. 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"]

点击下面按钮下载文件:

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注