Last active
January 1, 2024 17:54
-
-
Save eri-trabiccolo/aebb741a2f5b28d22b3e to your computer and use it in GitHub Desktop.
open wordpress rss widget links in a new window
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
add_action('wp_footer' , 'rss_widget_links_in_new_window'); | |
function rss_widget_links_in_new_window() { | |
?> | |
<script type="text/javascript"> | |
! function ($) { | |
//prevents js conflicts | |
"use strict"; | |
$(function () { | |
var extLinksStyle = true; /* set this to false to not display the external icon */ | |
$('a', '.widget.widget_rss').each( function() { | |
if ( extLinksStyle && $(this).children('img').length == 0 ) | |
$(this).after('<span class="tc-external">'); | |
$(this).attr('target' , '_blank'); | |
}); | |
}); | |
}(window.jQuery) | |
</script> | |
<?php | |
} |
Works like a charm! Thanks!
Works perfect. Thank you!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Amazing. Did exactly what it was supposed to. Thanks man.