What Are Shortcodes?

Utilizing shortcodes is very easy. To use one, create a new post (or edit an existing one), switch the editor to HTML mode and type a shortcode in brackets, such as:

[showcase]

It is also possible to use attributes with shortcodes. A shortcode with attributes would appear similar to the following:

[showcase id=”5″]

Shortcodes may also embed material, as demonstrated here:

[url rel=”nofollow” onclick=”javascript:_gaq.push([‘_trackPageview’, ‘/outgoing/article_exit_link’]);” href=”http://www.yoursite.com”]Your Site[/url]

Shortcodes will be taken care of by a set of functions introduced in WordPress 2.5 called the Shortcode API. Each time a post is saved, the subject material is actually parsed, and the shortcode API instantly transforms your shortcodes to carry out the function they’re designed to operate.

Producing a super easy Shortcode

The thing to keep in mind while using shortcodes is always that they’re very simple to set-up. Once you know how to write a simple PHP function, then you already understand how to develop a WordPress shortcode. For the very first one, let’s create the particular well-known “Hello, World” message.

Open the functions.php file in your theme. If the file doesn’t exists, create it.
First, we’ve to make a function to return the “Hello World” string. Paste this in your functions.php file:

function hello() {

return ‘Hello, World!’;

}

Since we have a function, we have to transform it into a shortcode. Thanks to the add_shortcode() function, this is very easy to carry out. Paste this line immediately after the hello() function, then save as well as close the functions.php file: add_shortcode(‘hw’, ‘hello’); The first parameter is the shortcode name, and the second would be the function to be called.
Now that the shortcode is created, we can make use of it inside blog posts and on pages. To utilize it, simply swap the editor to HTML setting as well as type the following: [hw] You’re done! Obviously, this is a very basic shortcode, however it is a very good demonstration of how simple it is to produce one.
There is still an easier way

Let’s just take this one phase deeper and think about doing more or less everything with the click of a button!WordPress shortcode plugin , Shortcode Kid can perform this and more and can certainly help to make your blogging life much easier. Shortcode Kid provides over 100 killer ready-to-use WordPress shortcodes that will raise your blogging working experience.

You can now take all of the shortcodes with you!

You don’t need to worry about a new theme having built in shortcodes. This Shortcode WordPress plugin allows you to instantly include in excess of 100 shortcodes to any WordPress theme.

On one occasion someone said not to keep all my eggs in one basket. It is a excellent perception. I have really tried to carry this to heart and branch out whenever possible. That’s why I continually try to find out SOMETHING about EVERYTHING in which I can. I think it really is better to know a little about everything as compared to everything on the subject of one thing. It helps to support a person’s universe and provides an individual much more versatility in every day life, discussions as well as the job market.

Article from articlesbase.com

Related WordPress Plugin Articles

Tagged with:

Filed under: Plugins

Like this post? Subscribe to my RSS feed and get loads more!