Created
November 25, 2025 02:42
-
-
Save JoelEadeDesign/16fbac5d1b24a8ed225151bc3b8d6c9e to your computer and use it in GitHub Desktop.
Bluesky Share Icon Shortcode for Elementor
This file contains hidden or 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
| // Function to create the BlueSky share button as an Elementor-style element | |
| function generate_bluesky_elementor_button() { | |
| if (is_singular(['post', 'page'])) { | |
| $post_title = get_the_title(); // Get the current post title | |
| $post_url = get_permalink(); // Get the current post URL | |
| $encoded_title = urlencode($post_title); // URL encode the post title | |
| $encoded_url = urlencode($post_url); // URL encode the post URL | |
| $bluesky_url = "https://bsky.app/intent/compose?text={$encoded_title}%20{$encoded_url}"; // Create the full BlueSky URL | |
| // Custom SVG code for BlueSky logo | |
| $bluesky_svg = '<svg height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="m5.42893 3.17499c2.65984 1.99684 5.52077 6.0456 6.57117 8.21841 1.0505-2.17265 3.9113-6.22161 6.5712-8.21841 1.9192-1.44084 5.0288-2.555679 5.0288.9918 0 .70848-.4062 5.95161-.6444 6.80281-.8281 2.9594-3.8458 3.7142-6.53 3.2573 4.692.7986 5.8856 3.4437 3.3079 6.0888-4.8956 5.0236-7.0364-1.2604-7.5852-2.8706-.1006-.2952-.1476-.4333-.1483-.3159-.0007-.1174-.0478.0207-.1483.3159-.5486 1.6102-2.68937 7.8944-7.58525 2.8706-2.57776-2.6451-1.3842-5.2904 3.30788-6.0888-2.68432.4569-5.702-.298-6.53-3.2573-.238244-.8513-.644436-6.09441-.644436-6.80281 0-3.547479 3.109676-2.43264 5.028796-.9918z" /></svg>'; | |
| // Create the HTML structure with link wrapping | |
| return ' | |
| <a href="' . esc_url($bluesky_url) . '" class="elementor-share-btn elementor-share-btn_bluesky" role="button" tabindex="0" aria-label="Share on BlueSky" target="_blank"> | |
| <span class="elementor-share-btn__icon"> | |
| ' . $bluesky_svg . ' | |
| </span> | |
| <div class="elementor-share-btn__text"> | |
| <span class="elementor-share-btn__title">BlueSky</span> | |
| </div> | |
| </a>'; | |
| } | |
| return ''; // Return empty if not on a single post page | |
| } | |
| // Register the shortcode | |
| add_shortcode('bluesky_elementor', 'generate_bluesky_elementor_button'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment