Skip to content

Instantly share code, notes, and snippets.

@Forsskieken
Forked from fabrizim/replace-bird-with-x.php
Last active November 28, 2023 09:33
Show Gist options
  • Save Forsskieken/61a55f09e2cf46a283c3866a2a0fe415 to your computer and use it in GitHub Desktop.
Save Forsskieken/61a55f09e2cf46a283c3866a2a0fe415 to your computer and use it in GitHub Desktop.
Elementor: Replace Twitter Icon with new X Icon
<?php
/*
Plugin Name: X is new Twitter
Description: Change bird into X
Version: 1.0
Author: Your Name
*/
add_filter( 'elementor/widget/render_content', function($output){
// replace the
$re = '/(<svg[^>]+class="[^"]*e-fab-twitter".*?<path\s+d=")(.+?)(".+?<\/svg>)/s';
$output = preg_replace_callback($re, function($matches){
$path = "M389.2 48h70.6L305.6 224.2 487 464H345L233.7 318.6 106.5 464H35.8L200.7 275.5 26.8 48H172.4L272.9 180.9 389.2 48zM364.4 421.8h39.1L151.1 88h-42L364.4 421.8z";
return $matches[1].$path.$matches[3];
}, $output);
return $output;
}, 10, 2 );
@Forsskieken
Copy link
Author

Forsskieken commented Nov 28, 2023

Save as zip and then upload this file as a new plugin

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