Less than a week ago, I released a new WordPress plugin called “Reorder Gallery” which gave you the ability to change the order of your images when you uploaded them, so that the gallery shortcode would display them in an order of your choosing. Two days later, Matt Mullenweg stopped by to say that it “would be pretty cool functionality for core WP” so I offered to add it in. It’s now done, and you can look forward to seeing it in WordPress 2.6.
First I touched on the topic in my first impressions of WordPress 2.5. Then I whined a little about the tickets relating to them, and eventually I released my Google Maps Plugin that uses them. In the end, WordPress’s new shortcodes are really nice.
What are they?
First of all, a shortcode called “mycode” can look like any of these:
[mycode] [mycode foo="bar" id="123" color="red" something="data"] [mycode]Some Content[/mycode] [mycode]<p><a href="http://example.com/">HTML Content</a></p>[/mycode] [mycode]Content [another-shotcode] more content[/mycode] [mycode foo="bar" id="123"]Some Content[/mycode]
As you can see, shortcodes allow a user to put a code into a post or page, and a plugin can then easily handle those codes. They can be nested, contain content (including HTML), attributes, etc. Sounds great, but how can you leverage shortcodes for your benefit?
How can I use them?
You want to leverage the new, powerful shortcode system in WordPress 2.5, but where do you start?