Using shortcodes with Easy Registration Forms

What is shortcode in WordPress?

Shortcode is a dedicated snippet of code, used to execute a specific and dedicated function in WordPress. By default, WordPress doesn’t allow to write code in the content, but sometimes situations occur where you just need to add custom code. Shortcode makes it possible to add it.

How to create and use shortcode

Below is an example of how to add custom shortcode.

You can create a function on function on file ‘function.php’

function shortcode_function() {	
    echo “I got executed by a shortcode.”
}
add_shortcode('my-custom-shortcode’, 'shortcode_function');

Congratulations following above steps, you’ve successfully created your first usable shortcode.

Methods of using a shortcode.

There are primarily 2 methods of executing a shortcode.

  1. Using code : do_shortcode()
    echo do_shortcode( 'my-custom-shortcode' );
  2. Using brackets method – This message is most widely used in WordPress.
    It is represented as [‘my-shortcode]

Many of the popular themes and plugins make use of shortcode to display elements or to perform a dedicated function to ease up the process of executing code in between the content.

How to use shortcodes in Easy Registration Forms.

Easy Registration Forms gives amazing flexibility to use shortcodes with your form to display elements and perform custom operations on form submission.

For eg: One of our clients was looking for a feature that can update the status of user associated detail after submission but was willing to keep the code separate and query were to be made custom for this requirement. Easy Registration Forms is well equipped to handle the execution of shortcode. This feature that makes Easy Registration Forms stand out being a developer-friendly plugin.

Where to put the shortcode in Easy Registration Forms.

Easy Registration forms give you the flexibility to put shortcodes in various areas including Form builder ( yes you read it correctly), form configuration in Display Settings, Notifications, and in Post Submissions.

Executing Shortcodes in configuration area makes this plugin powerful, flexible and developer-friendly.

Let’s take a scenario where you want to add custom functionality after Easy Registration Form Submission. Create a shortcode, write custom code and put in Post Submission in Form Configuration, this code will be executed after form submission and similarly, other custom functions can also be executed using shortcode in Easy Registration Forms.

 

Feel free to contact us here.

5 Replies to “Using shortcodes with Easy Registration Forms”

  1. The only form plugin i found that lets me insert a text field and associate it with a custom meta created by another plugin! I use this to ask my customers for VAT number when applying for a B2B account in Woocommerce. As for the EU VAT number field i used the Booster for Woocommerce (EU VAT number). I had an issue and the developer helped me way more than i expected!

Leave a Reply

Your email address will not be published. Required fields are marked *