Shortcode, Beware of them

shortcodeSince the the release of WordPress 2.5 Shortcodes have been really popular and developers and user love it. Shortcodes have been extensively used to create a visually good looking content in WordPress.

Basically Shortcodes converts multiple lines of codes that performs specific task to a small WordPress specific code. Shortcodes looks like this [shortcode] or if wrapped with contents may look like [shortcode] Some Content Here [/shortcode].

Shortcodes have been used for multiple purposes like

  • displaying recent posts
  • Creating multiple columns
  • Create a  blockquote
  • Create tabs and accordions
  • Simple Tabs
  • Display Twitter Feed, Etc and many more.

So why this article? Is Shortcode Bad?

No, Shortcodes are really useful and it has brought many easy solutions for developers and users. But, if shortcodes are setup directly in theme, then it might create problem in future. This is because when we implement shortcodes in a theme directly, it becomes available to that particular theme only. If we change to another theme then all of the shortcodes will be unavailable and all we will be left is texts and visually it will look really bad. All the styles that came with shortcodes will be gone, if you had setup tabs and accordions will be gone. if you were displaying recent posts, you will only get something like this [recent-posts].

When creating shortcodes we should keep in mind all the factors that might affect the site if we use the shortcode. The best solution of this would be creating a separate plugin for the shortcodes with all the necessary styles and functions. This will make the shortcode independent of the theme and easily be run and implemented without hampering the site’s look even if the theme is changed.

Some good available plugins for Shortcodes are:

But in the end it’s up to you to decide how to use the shorcodes in the best way possible. Happy Coding 🙂


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s