|
Posted on
09.30.07 by Widge @ 1:53 am
Okay, next up: the link quicktag. On Needcoffee, we have internal links and external links. Internal links are just plain old links. External links open in a new window. I know that irritates a few people, but I have no idea why. You close the window and you're where you came from. Seems like a no brainer to me. Anyway. Same deal as before: 1. Go to /wp-includes/js/ 2. Edit quicktags.js 3. Look for this code:
Now, in the first block of code, all I've done is change that third line, which is what the button is labeled. Because I want to differentiate between the two types of links, I've changed "link" to "int link." And then I've basically copied the same code again, but this time the button's called "ext link." Also, you see the sixth lines–that's supposed to be an access key. I never use this, but I went ahead and put an X for the second one, just in case. Oh, and I almost forgot: you see where the first button does an "ed_link" thing. Well, since I'm not a real coder, I don't know precisely what the hell that does–it does a call out to a function we'll get to in a minute. So I must made "ed_extlink" the second one. 5. Now look for this section of code, that starts with "function edShowButton". It's that aforementioned function business. As before, I've put in line breaks where there normally aren't any, just to preserve the width of my theme here.
The first bit, the "ed_link" section, we really don't need to screw with. But we need to add a function bit for "ext_edlink." It's basically the same thing as the one above it, so the two together now look like this:
No sweat. 6. Now there's a section marked "function edInsertLink" which we don't need to screw with, because really all we've done for internal links is change the button label. But we need to add a new section. Here's what I've put in directly after the edInsertLink bit:
Basically all I've done is copy the code, change "edInsertLink" to "edInsertExtLink" and stick the target="_blank"> in. That line used to look like this:
But I made it this:
7. And that's it. You should be good. Bear in mind I'm a writer, not a coder. So if this screws up your site, it's your own lookout. Backup files before you screw with them. YMMV. Taggification: javascript, linking, quicktags, targeting, Wordpress Filed under: Wordpress
|

John Robinson is a writer of prose, poetry and comics who also writes under
the pseudonym of Widgett Walls.
This is my latest book. Short stories written especially for you, or at least someone who reminded me a lot of you at the time.