post-page

Mastering WordPress Shortcodes

12
responses
by
 
on
February 11th, 2009
in
Cool Scripts, WordPress Hack

Mastering WordPress Shortcodes.: Smashing Magazine had a nice instructional writeup on mastering WordPress shortcodes and creating new ones to make one’s blogging life easier. Shortcodes are small peices of pre-determined code (viewable in the HTML version of a post) that are later expanded by WordPress when a post is published and subsequently displayed. Shortcodes are already used by WordPress for many internal functions such as albums. This tutorial goes into details of the shortcode API in WordPress and into some detail of creating advanced shortcodes to accomplish tasks such as

  • Send to Twitter (or consequently, send to Techmeme via Twitter)
  • Create an RSS feed link
  • Insert Adsense into a post
  • Insert an RSS reader into a post
  • Add shortcodes to sidebars

Please let us know if you have used any of these or know of/have created others that might be useful.

heading
heading
12
Responses

 

Comments

  1. Ann-Kat (6 comments.) says:

    It looks as though you’ve had the design cleaned and tightened up a bit since I was last here. Like it a lot!! Nice job.

  2. demetris (9 comments.) says:

    I hate shortcodes!

    You use something for a while, then remove it, and you are left with the ugly shortcodes in your content.

    You can of course run a replacement in the database, to remove the orphan shortcodes, but I don’t think this whole concept goes well with software that wants to be friendly and usable.

    BTW, I like the new, cleaner design. Congrats!

  3. Jake Song (1 comments.) says:

    I think It is very helpful to wordpress user, especially a beginner like me.

  4. George Serradinho (107 comments.) says:

    Hi and thanks for the info. Now days everyone is talking about shortcodes, I guess I have some reading to do

  5. Viper007Bond (91 comments.) says:

    Here’s a simple shortcode-powered BBCode plugin I wrote 6 months back mainly as a way to demonstrate the usage of the shortcodes system:

    http://wordpress.org/extend/plugins/bbcode/

    I personally use shortcodes in most of my plugins though. My Video Quicktags plugin entirely uses shortcodes for it’s video embeds. It’s sooooo much easier than having to parse the posts yourself with your own regex.

    APIs FTW.

  6. Banago (84 comments.) says:

    I read that – It was a great article.

  7. Armand (5 comments.) says:

    I’ll keep my eyes to get more information about it. Thanks.

  8. Hikari (79 comments.) says:

    COOL!!

    I’ve already used shortcodes a lot of times, but I didn’t know what they were and how to create mine! That may be very useful in the future…

    But creating shortcodes inside a theme demands more risk, because I may need to update the theme later and forget about shortcodes I created… I will look for a plugin solution that could help me :)

  9. Grace joubarne (1 comments.) says:

    “mastering WordPress shortcodes and creating new ones to make one’s blogging life easier. ”
    or
    “You use something for a while, then remove it, and you are left with the ugly shortcodes in your content.”

    I think short codes as a concept are OK but the implementation requirement is flawed. Isn’t WP as a CMS about making it easy for John Q Public to have a say on the internet? I mean without having to be deep in mystifying code schlepping… and remembering syntax… and what plug in used that short code… and did I change it out cause it broke the newest geegaw I installed?

    Code is code (complicated) and short codes have their place for those who are in their own posts everyday. Many (most?) of us post once a week or less and are not familiar at all with the “finer details.” Nor really will they help until they are standard.



Obviously Powered by WordPress. © 2003-2013

page counter
css.php