Maybe you are, but I’m not.

« Back Pain Strikes Out Of Nowhere Lawyer Leaves All For Scented Candles »

Custom Buttons In The WordPress Editor


Posted by Non-Hamster on July 5th, 2012

Once upon a time when using earlier versions of WordPress (2.5 and before) it was possible to edit the "quicktags.js" file and add customized buttons to the html editor.

One of the customized buttons that I added simply added ' rel="nofollow"' at the current cursor position.  It was very handy for adding nofollow to links when editing old posts after the big "Google slap" in the fall of 2007 remove authority from old links without removing the links entirely.

The code that created that button in quicktags.js was this:

edButtons[edButtons.length] =
new edButton('ed_nofol'
,'AddNF'
,' rel="nofollow" '
,''
,'['
,-1
); // special case

Later I was able to accomplish something even better.  I copied the code that created the "Link" button, renamed it to "NFLink" and edited the code so that instead of creating a standard link, it would create one with rel="nofollow" in it.

I also had added buttons that allowed me to easily add angle brackets, subscript, superscript and more, all without having to manually type out the html codes every time because that's what the buttons did.

Of course, every time WordPress updated, the quicktags.js file was overwritten and I had to figure out how to do this all over again.  This would be one of the reasons that I have always been very resistant to upgrade WordPress.  Doing so broke something that took me hours, sometimes days, to create.

Fast forward to today.  WordPress has recently updated to 3.4.1 and I have just spent the large part of the last twelve hours trying to re-create those buttons.

The task is made even harder by the fact that quicktags.js, which used to be sensibly formatted, is now totally UN-formatted.  It's one single very long string of text.  No spaces, no line breaks, nothing.  Reading it is a total, complete, absolute f$*king nightmare.

I have also spent a considerable number of hours trying to find WordPress plugins that would accomplish these tasks.  I did find a few however most of them don't work at all in the current version 3.4.1.  One that does work will only apply nofollow to EVERY link in the post.  I consider this to be unacceptable in the extreme because I only want to nofollow some links, not all.

One solution that would be great would is to simply add a checkbox to the popup that appears when you hit the "Link" button.  Let the text next to it read "add nofollow" and when checked it would add rel="nofollow" to the link it created.

Why this was not coded in by the WordPress programmers in the first place I will never understand.  Especially since Google has made the use of nofollow more and more important if you want to keep your website or blog indexed with decent SERPs positions.

And so faithful reader, I come to the point now where I must ask if you know of a WordPress plugin that will, at the very least, allow me to specify if a link is to be nofollow or not.  Though the ability to add custom buttons to the html editor would also be fantastic.  I know that there are tutorials out there showing how to do it but none of them have been updated in years and only apply to very old versions of WordPress.

Oh, and before you suggest it, whether the "visual" wysiwyg editor can accomplish any of these functions is of no interest to me whatsoever because I totally despise that editor and ONLY use the html editor.

Be Sociable, Share!
  • Twitter
  • email
  • Facebook
  • StumbleUpon
  • Tumblr
  • Google Reader
If you enjoyed this post, make sure you subscribe to my RSS feed!
Link to this post
Just copy this code and paste it on your site where you want the link to appear:

No Comments

Sorry, the comment form is closed at this time.

Proudly powered by WordPress. Theme developed with WordPress Theme Generator.
Copyright © I Am Not A Hamster. All rights reserved.