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.
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.
I agree, I was hoping you’d post about it so I could praise the change also.
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!
…
What a silly comment.
Thanks for the thoughtful reply! 🙂
BTW, here is a plugin, made by a core WP developer to deal with the issue I described:
http://www.laptoptips.ca/projects/old-shortcodes/
http://wordpress.org/extend/pl.....hortcodes/
I think It is very helpful to wordpress user, especially a beginner like me.
Hi and thanks for the info. Now days everyone is talking about shortcodes, I guess I have some reading to do
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.
I read that – It was a great article.
I’ll keep my eyes to get more information about it. Thanks.
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 🙂
“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.