Pinterest Stumbleupon Whatsapp
Ads by Google

Wordpress Quicktags First of all, what are WordPress quicktags? You can see them in the picture below, they are the bits of code you can insert when you use the code interface in your WordPress editor.

Wordpress Quicktags

The reason they are so useful is that they allow you to insert start and end tags in a unique and easy way. Start writing and when you need the tag (i.e. bold, list etc.) click on its button and the start tag will be pasted. When you are ready to end the tag, just click on the same button and you will paste the end tag.

This user-friendliness is what I love in WordPress, and they have these quicktags for many of the most common uses. However, you may need to paste tags frequently which are quite long as well, let me show you an example.

For instance, lets say you want to optimize the relevance of your Google Adsense. In such cases you may want to tell the Adsense robot, what is not important (less relevant) in your content. This can be done using following tags:

<!– google_ad_section_start(weight=ignore) –> …. <!– google_ad_section_end –>

Ads by Google

Having to add these sections manually is a pain, especially if you use them a lot, together with the other tag that tells adsense that a section is important. Just like the other quicktag buttons, you can create one for yourself, which will paste these tags for you.

You will need to edit the file “quicktags.js”, which can be found in “/wp-includes/js/” directory of your WordPress installation. I suggest downloading it, creating a back-up and opening with a text editor. You will see some general code at the top, but after that, you should see blocks of code, beginning with “edButtons”. These are all the buttons already in your toolbar.

    edButtons[edButtons.length] =
    new edButton(‘ed_strong’
    ,’b’
    ,'<strong>’
    ,'</strong>’
    ,’b’
    );

The above code for example is the left most button that inserts <strong> tags.

Quicktags in wordpress

There are five parameters you can change and should change when creating a new button. The first is the name of the button. This can be found on the second line, ‘ed_strong’ is the name of this button, replace the phrase inside the apostrophes to change it. The lower case “b” in the third line will be shown on the button itself. If you were to replace the letter inside the apostrophe with the word “bold”, the button in the editor would show “bold”. The fourth and fifth line show the start and end tags, replace them with whatever you need. The lower case “b” in the sixth line is the hotkey you can use to access the tag when pressed together with the “alt” key.

That’s all there is to it, here’s what I did so I can paste the long code I showed above quickly.

edButtons[edButtons.length] =
new edButton(‘ed_unimp’
,’unimp’
,'<!- google_ad_section_start(weight=ignore) ->’
,'<!- google_ad_section_end ->’
,”
);

You can use this for pasting anything really, not just code. If you always begin your post with a specific text, and always end by signing off with the same text, you can enter it in this format. It’s not too flexible, but for basic needs it’ll do. But when it comes to tag pasting, this is a great way to save time and frustration.

  1. PPCInformer
    August 4, 2008 at 7:43 am

    Thats a great hack mate , very usefull. thanks for sharing it.

  2. Saijo George
    June 27, 2008 at 12:25 pm

    Exactly what I was after , thanks for the info mate. I am going to try it straight away

  3. jonny
    April 2, 2008 at 6:41 pm

    because the world needs so much love ... I'm blogging about your entry and linking to it from my blog.... and commenting on you blog
    Thanks for the TIP man

  4. Shankar Ganesh
    March 4, 2008 at 9:53 am

    This is wonderful and something I've never heard before. Thanks for sharing :)

  5. Daniel
    March 4, 2008 at 10:18 am

    Hi Keith!

    Thanks for that truly cool comment, I'll check out the plugin soon! I don't really mind hacking the code, I don't think it really is hacking, WordPress was meant to be hacked :) Just put a copy of files you've modified somewhere and upload them in one click later on :)

  6. Keith
    March 4, 2008 at 4:02 am

    Great article. It made me think how useful this could be for many repetitive tasks I currently do with cut and paste.

    I don't really like hacking WordPress code, because I always forget to redo it when I upgrade, so I searched for a plugin.

    I found one at http://roel.meurders.nl/wordpress-plugins/wp-addquicktag-plugin-for-adding-quicktags/

    Unfortunately, it is no longer supported by the author, but it still looks useful. I'll give it a try soon, and maybe write a review.

    I spotted your article via BlogRush on one of my sites. I can't see the BlogRush widget on your site - is it hiding somewhere?

    • Aibek
      March 5, 2008 at 10:28 am

      Hi Keith

      Thanks for the plugin, it definitely makes things a lot easier. :-)

      As for BR widget, we are optimizing our theme at the moment so it was temporaily removed.

Leave a Reply

Your email address will not be published. Required fields are marked *