Skip to content

Instantly share code, notes, and snippets.

@fabrizim
Last active November 28, 2023 09:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save fabrizim/ea5babff3835213b88db9909aa6c5538 to your computer and use it in GitHub Desktop.
Save fabrizim/ea5babff3835213b88db9909aa6c5538 to your computer and use it in GitHub Desktop.
Elementor: Replace Twitter Icon with new X Icon
<?php
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 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment