WordPress

WordPress – short codes

August 11, 2011  |  Posted by admin |  Comments Closed

Shortcodes is a feature added in release 2.5 of wordpress. Shortcodes allows specific features to be added directly into a blog post or page. This differs from a plugin which offers features at a page level or even at a site level.

The syntax for a short code in your blog is

[shortcodename][/shortcodename]

The shortcode executes the PHP code which performs an action at this precise point in the page. A short code may also pass attribute values which corresponds to parameters passed into the function being executed. This offers a richer set of features by allowing the function to behave in a different manner depending on the parameters/attributes being passed in. Here is the syntax of shortcodes with attributes:

[shortcodename attribute1=value1 attribute2=value2][/shortcodename]

In some instances the shortcode may perform some action with the content that exists between the open short code and close short code on the page.

[shortcodename attribute1=value1 attribute2=value2]content[/shortcodename]

Here is an example of how short codes can be used.

Keep tuned here as we will provide step by step instructions on how to write your own short codes that can be added to your pages.