1. Home
  2. Docs
  3. XYZ WP Insert Code Snippet Premium
  4. FAQ
  5. How can I pass parameter using the snippet?

How can I pass parameter using the snippet?

In the XYZ WP Insert code snippet premium plugin we can pass parameter through short code.

If you are passing custom parameters from the shortcode (eg: [xyz-ics snippet=”snippet” param1=”val1″]) you can use such parameters in the code by enclosing the parameter in curly braces (eg: {param1}).

See the example below.

parameter passing 1

Here in the snippet content we can add the parameters in braces. The parameters are {param1} and {date}.

In the short code when using in the site content, we can add the parameter and value like in the format  [xyz-ics snippet=”snippet” param1=”val1″] as given image.

parameter passing 2

Here the used short code is [xyz-ics snippet=”Test-Snippet” param1=”XYZScripts” date=”03 Jan 2018″] where first parameter is “param1” and its value is “XYZScripts” and the second parameter is “date” and its value is “03 Jan 2018”.

Now in the post it will display the parameter values like the following image.

parameter passing 3

 

Was this article helpful to you? Yes 12 No 15