Working with wordpress shortcodes

Share on FacebookTweet about this on TwitterShare on Google+Pin on PinterestShare on RedditDigg thisShare on TumblrPrint this page

Shortcodes play a vital role in wordpress theme and plugin development. Its one of the intermediate skill that a developer needs to learn and if mastered it can give you power of manipulating WP according to what a developer desire.

Note: Things to remember while using shorcodes:

  1. Prefer to use ‘return’ in place of ‘echo’ to avoid any flaw in DOM. Using ‘echo’ to return value to front end in most cases will add it to the top and that’s not something you want.
  2. Try avoiding use of breaking ‘php’ ie. ?> in between your returning variable. for eg:

  3. Try digging deep into using arguments the call back function of shortcode can take arguments that can be used in different scenarios.
  4. Using supplied arguments in callback function to populate output


There are far too many used cases examples of shortcodes that can take your wordpress development  skills to new level.

Used case examples of shortcode with a custom post type and custom taxonomy.



The following two tabs change content below.
Loves: " The Technology", Learning new stuff not necessarily tech related, acquires self proclaimed "Good sense of humor". Apart from Coding I do like Reading,Sketching observing other people, exploring whatever i come across and Going Places. More About Me