Home / Archive / Floating Social Media Icons (copy)
Duplicate Snippet

Embed Snippet on Your Site

Floating Social Media Icons (copy)

Display your Social Media accounts in a floating sidebar.

<10
Code Preview
php
<?php
    // Define social media links
    $facebook_link = 'https://facebook.com/fb';
    $twitter_link = 'https://youtube.com/@yt';
    $instagram_link = 'https://instagram.com/ig';
    echo '
    
        .floating-social-icons {
            position: fixed;
            top: 50%;
            left: 0;
            transform: translateY(-50%);
            z-index: 1000;
        }
        .floating-social-icons a {
            display: block;
            margin: 5px 0;
            width: 40px;
            height: 40px;
            background-color: #333;
            color: white;
            text-align: center;
            line-height: 40px;
            border-radius: 50%;
            transition: background-color 0.3s;
        }
        .floating-social-icons a:hover {
            background-color: #000;
        }
        .floating-social-icons a svg {
            width: 20px;
            height: 20px;
            fill: white;
            vertical-align: middle;
        }
    
    <div class="floating-social-icons">
        <a href="' . esc_url( $facebook_link ) . '" target="_blank" rel="noopener">
            
                
            
        </a>
        <a href="' . esc_url( $youtube_link ) . '" target="_blank" rel="noopener">
            
                
            
        </a>
        <a href="' . esc_url( $instagram_link ) . '" target="_blank" rel="noopener">
            
                
            
        </a>
    </div>
    ';

Comments

Add a Comment