Create shortcode in WordPress

Shortcodes are one of the best things about WordPress. It makes it extremely easy to use.

A shortcode is a WordPress-specific code that lets you do nifty things with very little effort. Shortcodes can embed files or create objects that would normally require lots of complicated, ugly code in just one line. Shortcode = shortcut. https://en.support.wordpress.com/shortcodes/

Let us create a simple form just to show you how easy it is.

  1. Open your functions.php
  2. Copy and paste the following code into your functions file.
  3. Place the shortcode on any WordPress page.
  4. You can also call a Shortcode with PHP.
    1.   do_shortcode(‘[showform]’);

[snippet slug=create-shortcode lang=php]

Post a comment