Last active
August 29, 2015 14:16
-
-
Save purzlbaum/333ee4db713dd9d2db44 to your computer and use it in GitHub Desktop.
This file contains 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
a.external { | |
content: " \f08e"; | |
font: normal normal normal 14px/1 FontAwesome; | |
} |
This file contains 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
<?php | |
/* | |
Sets "external" class for external links and open them in a new tab/window | |
*/ | |
function cs_bootstrap_external_link($text) { | |
$wpUrl = get_bloginfo('url'); | |
$return = str_replace('href=', 'class="external" href=', $text); | |
$return = str_replace('class="external" target="_blank" href="' . $wpUrl . '', 'href="' . $wpUrl . '', $return); | |
$return = str_replace('class="external" target="_blank" href="#', 'href="#', $return); | |
return $return; | |
} | |
add_filter('the_content', 'cs_bootstrap_external_link'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment