REALITYPOD
Realitypod

Creating Shortcodes in WordPress

WordPress shortcodes are specific codes that allow the users to achieve things with a very simple short code which is very difficult to create otherwise. Shortcodes can also be used to create objects and embed files.

Creating a shortcode in WordPress is a very simple task. It is just like a basic function of PHP. To create a simple code of Hello world, follow the given steps.

  • Create the file functions.php.
  • Make a function that returns the string of “Hello World”.

  • To turn this function in to a shortcode, paste add_shortcode() function after the hello() function. Save it and exit the PHP file.

  • Here name of the shortcode is the first parameter and the second parameter is of the function.
  • Now you can use this shortcode anywhere on the blogs or other pages. To use it, switch to html editor and write the following function

Creating Advanced Shortcodes

In advance shortcodes, attributes are used with shortcodes such as to pass arguments to functions. Following procedure will describe how to display a URL.

  • Open the file functions.php and add the following function to it.

  • Convert this function to a shortcode.

  • Now this shortcode can be used anywhere

 

Related posts

Activating iOS 5.0 Beta without using developer account

Realitypod

Seven Mind-Blowing Recent Scientific Discoveries

Realitypod

Necessities For Selling At Events

Realitypod