888888.888888.88""Yb..dP"Yb..8888b..Yb..dP.88b.88....db....8b....d8.88..dP""b8..dP"Y8
88__...88__...88__dP.dP...Yb..8I..Yb.YbdP..88Yb88...dPYb...88b..d88.88.dP...`".`Ybo."
88""...88""...88"Yb..Yb...dP..8I..dY..8P...88.Y88..dP__Yb..88YbdP88.88.Yb......o.`Y8b
88.....888888.88..Yb..YbodP..8888Y"..dP....88..Y8.dP""""Yb.88.YY.88.88..YboodP.8bodP'


88b.88.888888.888888.Yb........dP.dP"Yb..88""Yb.88..dP
88Yb88.88__.....88....Yb..db..dP.dP...Yb.88__dP.88odP.
88.Y88.88"".....88.....YbdPYbdP..Yb...dP.88"Yb..88"Yb.
88..Y8.888888...88......YP..YP....YbodP..88..Yb.88..Yb

April 9, 2008

WordPress 2.5 implemented a new way of inserting content into posts: shortcodes. If you haven’t had the need to use the new gallery shortcode you might not have come across the details. So, what are they?

Plugin authors have used all sorts of methods of adding codes to posts to specify where the content of their plugin should be included. Shortcodes takes this idea, and builds a standard method into WordPress.

There is one included in WordPress 2.5 by default and that is the gallery shortcode. The gallery shortcode inserts all of the images that are attached to the post into that post using one simple code that looks like this: [gallery]

Shortcodes also accept options so, for example, if you wanted to include the gallery from a different post you can specify the post id, like this: [gallery id=”6″]

The gallery shortcode also lets you specify the order of the images, the size, the way they are marked up, by default it uses a definition list, and the number of columns. You can read more about the options in the gallery shortcode at the WordPress Codex.

Shortcodes can even be used to surround text, if the plugin requires it: [code]Some text here[/code]

Shortcodes should help to bring consistency to the way plugins work, helping users to get to grips with them more easily, but also help plugin authors. There is an easy to use API that takes the work out of producing plugins that find and replace content, or even just insert it, with options.

I have used it for one plugin so far. Fun with Photo Data displays EXIF data in a list. While it wasn’t difficult to create without shortcodes, using the Shorcodes API made it easier still. For complex plugins this could be make a significant difference.

My WordPress plugin generator has been updated to include shortcode functionality and you can read more information about the Shortcodes API at the WordPress Codex.

Using Wordpress As A Php Framework
Using wordpress as a framework?
2 comments
page 335
Using Your Own Url Shortener
Rewriterule shorten url?
4 comments
page 1190
Post Image The Easy Peasy Way
Finding attached image with post in wordpress?
26 comments
page 1065
My Experience Of Flexx
How to edit flexx theme wordpress?
4 comments
page 1026
Wordpress 25 Exif Fields
Wordpress exif plugin?
12 comments
page 230
Post Image The Easy Peasy Way
List image attachments wordpress?
26 comments
page 1065
Html 5 Gallery
Html 5 photo gallery?
6 comments
page 1305
Post Image The Easy Peasy Way
Wp image attached linkable?
26 comments
page 1065
Post Image The Easy Peasy Way
Wp get first image for post?
26 comments
page 1065
Updating Code Snippets Here
Cacheaboutblank?
no comment
page 1338
Html 5 Gallery
Html5 photo gallery?
6 comments
page 1305
Quick N Dirty Admin Login Screen
Simple login screen css?
no comment
page 128
Six Million Ways To Die Choose One
One million ways to die?
14 comments
page 1128
Updating Code Snippets Here
Interesting wordpress websites?
no comment
page 1338
Post Image The Easy Peasy Way
Attachment images in wordpress single posts?
26 comments
page 1065
Six Million Ways To Die Choose One
Is there an easy way to die?
14 comments
page 1128
Quick N Dirty Replacement Text
Addaction replacement?
no comment
page 122
Html 5 Gallery
Html5 photo gallery?
6 comments
page 1305
Are Child Themes The Best Option
Thesis child theme?
15 comments
page 1262
Charcoal Theme Available For Wordpress
Charcoal wordpress site admin?
2 comments
page 959
Post Image The Easy Peasy Way
Finding attached image with post in wordpress?
26 comments
page 1065
How To Add Sidebars To A Theme
Register sidebar in functionphp?
10 comments
page 1053
Post Image The Easy Peasy Way
Finding attached image with post in wordpress?
26 comments
page 1065
What A Body
Whatabodybiz?
11 comments
page 1126
Html 5 Gallery
Html5 chat?
6 comments
page 1305
Why I Ditched Disqus
Disqus themes?
5 comments
page 1175
Post Image The Easy Peasy Way
How to use wp get attachment url?
26 comments
page 1065
Adding Settings To Admin Pages
Admin add field wordpress?
3 comments
page 793
Wordpress Chat
Wp chat page?
3 comments
page 1308
Html 5 Gallery
Html5 and tabs?
6 comments
page 1305
Post Image The Easy Peasy Way
Finding attached image with post in wordpress?
26 comments
page 1065
Creating Custom Urls
Custom url rewrite wordpress?
6 comments
page 80
  1 query every 1569 seconds, updated 1 seconds ago.
Post a comment?