Shortcodes

A shortcode is just “code shorthand”. It’s a way to say to WordPress, “I want you to run some code here, but I don’t want to type out the whole command”. It’s an easy way to insert fancy features into your normal pages without having to write a bunch of code.

Click on Pages and either create a new page, or click on Sample Page, and let’s use a shortcode to put tabs in our page!

In the normal editing area of your page, type (or copy/paste) the following:

[tab:First Tab]

This is the text for my first tab.

[tab:Second tab]

This will only show up on the second tab.

[tab:END]

This text will show up no matter which tab is active

Once you’ve typed this into your page, update the page and then click View Page at the top of the screen to see the results. You should have two tabs on your screen, “First tab” and “Second tab”, with some text that shows up only on those individual tabs, plus some text below that which shows up no matter which tab is selected.

 

Welcome to the magic of shortcodes!

Many plugins will have their own shortcodes which allow you to very quickly, with no actual code, to tell the plugin that you want it to do something specific on the page, at the spot you’ve typed the shortcode. Since actual code can’t be typed directly into the page editor, this is a way that regular users (not just administrators) can insert more complex elements into a page, with NO CODE REQUIRED!