Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Just want to know on "short code"

I have a plugin on my word press site that uses short code. I am not sure what short code is. I know it is functional like Javascript. But is it just referring to lots of types of code and just functions needed for the plugin? I guess what is short code?

2 Answers

Kevin Korte
Kevin Korte
28,148 Points

Shortcodes are snippets of code in square brackets that you place in a content box, and when that page is loaded, that shortcode is turned into some other piece of code and or data.

For instance, I have use a table plugin, and I build my table in the plugin, and it gives me a shortcode for that table with a unique ID. I put that shortcode in the content box of WP for a new post, and when that post is navigated to on the front end, my table of information is shown in place of the shortcode.

So that shortcode might look like:


Shortcodes can be just about anything, and do just about anything, depending on the plugin that is using them. Think of them as basically bookmarks for data from another source to be put in, right at that spot.

Form plugins are another source for a shortcode. Many form plugins, you build the form in the plugin, and than use a unique shortcode. WP will replace the shortcode with the correct form before it get's sent to the browser, and boom, you have a form.

Thank you Kevin I had heard a lot about short code but not just how it functions. I had guessed it worked something like that but not quite. I am just learning so I wanted to know what I could be talking about to future customers. Have agreat day.