This plugin has been moved to my code section, here.
WP: Identify External Links
This plugin will add a special CSS class to all links in your entries and in your comments that go to external sites (sites other than your site).
Download
Instructions
Copy and paste the text. Save it in a file named identify-external-links.php
. Make sure there are no spaces before the opening <?php
or after the closing ?>
. Activate it from within the WordPress admin interface. You can then use a.extlink { }
in your CSS to style it.
You can also edit the plugin to make it do other things like add target="_blank"
to external links or to add special things only to your internal links.
Versions
- Version 1.2 Doesn’t apply
extlink
class if there is an image within the link - Version 1.1 Works for subdomains now (thanks h0bbel!)
- Version 1.0 Initial release
ColdForged says
You are prolific.
Doug Stewart says
Hmmm. Odd. When I activate the plugin, I get the following output in my admin section:
Site still renders just fine. Any ideas what might be causing this?
Doug Stewart says
Bah. Nevermind. Stinking space after the ?> closing the plugin did it.
/me smacks forehead in disgust.
Doug Stewart says
I ganked your external link icon. Hope you don’t mind (I’ll remove it if it’s an issue…).
Mark says
Doug,
Not a problem. Mine is a slightly modified (made lighter) version of a freely availible “external link” icon. See here.
Ivar says
Nice work.
I don’t use WordPress, but I think I can modfiy it slightly to fit in nicely with mine.
Jens says
hi mark. this is a nice feature i’d like to include on my site. but somehow i don’t get it running. it’s activated and i modified my style:
.extlink {
padding-right: 9px;
background: url(images/spring_flavour/post_yellow.gif) no-repeat right;}
but it doesn’t work. i also use the quickcounter plugin and deactivated it but nothing happens. any idea?
by the way: very nice styled blug you have here!
Jens says
ooops, got it working now… i shouldn’t use wp-cache, i suppose (well, at least not at the moment while I’m working on the desihn of my blog…)
Donald Noble says
A simple way to achieve this is possible using just CSS3 (although only supported by a few browsers at present)
Just add the following CSS to your site:
a[href^="http://"]:before, a[href^="https://"]:before
{content:"21EA"}
Adds an up arrow before external links, see my site for an example.
Note, when using this in WP, set your blog URL to just
/
so that internal links are not prefixed byhttp://
Mark says
Donald, you could also just set a later rule for
a[href^="http://yoursite.com"]:before {content:"";}
that would override the earlier:before
for links to your site.If IE6 supported this kind of stuff, there are all sorts of cool things we could do like that. the
:first-child
pseudo-class would be particularly handy.Makki says
Parse error: parse error, unexpected T_VARIABLE in /home/makki/public_html/wp-content/plugins/identify-external-links.php on line 14
Please help im stuck :/
David says
Cheers. I would never in a million years have tracked that down!
Strider says
Parse error: parse error, unexpected T_VARIABLE in /home/stride/public_html/blog/wp-content/plugins/identify-external-links.php on line 14
I’m getting this error as well.
Mark says
Strider, check out comment #13.
task says
eny way of removing them to images?!
Mark says
Not that I know of, at least for Internet Explorer.
task says
if there is for Firefox i wolud like it to know 🙂
Mark says
Task, hm… couldn’t find the link, so I did it one better. Download the plugin again… it now will strip the
extlink
class if there is an<img />
tag within the link! Seems to work for me, but let me know if you have any problems with it.task says
cool! now it works on both!! FX AND IE!!
check @ http://wearemad.weblogs.us/
JJ says
What license is this under? I’d like to incorporate some of this code into a plugin I’m working on and would like to release as GPL. Thanks.
Mark says
JJ, GPL is fine by me!
task says
hi again… it’s me
is there any way to work together with smart links?!
http://www.semiologic.com/projects/smart-link
Denis de Bernardy says
This plugin would play better with Markdown and my smart link plugin with a filter priority of, say, 100000. 🙂
task says
cool, making that fix the problem…
but when using [etc->@] (searching in the same blog) the plugin thinks is a external one… 🙁
may be something easy to fix?!
Dasme says
Great plug-in.. I just wanted to say thanks! My site is being slowly moved over to wordpress from MovableType. There are so many great plugins and spam protection in WP that I don’t know why I didn’t move earlier!
Monica says
Hi,
I downloaded WP the a few days ago and the external links-plugin yesterday.
What I don’t understand is where I add the target=”_blank”?
The plugin is activated and I use the default theme. Right now all external links opens up in the same window.
Perhaps you can help me with further instructions since I’m a total novice on the subject.
Best regards och TIA,
Monica