Title: Dynamic Shortcode Builder?
Last modified: July 20, 2023

---

# Dynamic Shortcode Builder?

 *  [jyonan](https://wordpress.org/support/users/jyonan/)
 * (@jyonan)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/dynamic-shortcode-builder/)
 * Hello All,
 * I have a real estate website and I have subscribed to an IDX property data provider.
   In order to provide SOLD data to my customers, the IDX provider allows me to 
   create static shortcodes with specific search parameters (# of bedrooms, baths,
   sq. ft., etc…). However, I want to allow my customers to enter their own search
   criteria. The only way to extract the SOLD data is by creating a shortcode.
   I
   am not a developer. Is there a plugin that would work with a form builder where
   I could build a shortcode string using the values from the form? In other words,
   is there something out there that I could create a real estate search criteria
   form on the front-end and have it populate the shortcode parameter string on 
   the back-end and replace a variable I set where the actual shortcode is placed?
   I hope this makes sense…I also hope I am posting this in the right place.Thank
   you in advance!!!
    -  This topic was modified 2 years, 10 months ago by [jyonan](https://wordpress.org/support/users/jyonan/).

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [enigma123](https://wordpress.org/support/users/enigma123/)
 * (@enigma123)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/dynamic-shortcode-builder/#post-16910092)
 * Yes, there are plugins available that can help you achieve the functionality 
   you described, allowing you to build a real estate search criteria form on the
   front-end and generate the shortcode dynamically based on the user’s input. One
   such plugin that can help you achieve this is the “Shortcode Variables” plugin.
 * The “Shortcode Variables” plugin lets you define variables within your shortcode
   and replace them with user-provided values from a form. Here’s a general [overview ](http://www.abc.com)
   of how you can set it up:
    1. Install and activate the “Shortcode Variables” plugin from the WordPress plugin
       repository.
    2. Create a form using a form builder plugin such as “WPForms” or “Gravity Forms.”
       In this form, add fields for the search criteria you want to collect from your
       customers, such as the number of bedrooms, bathrooms, square footage, etc.
    3. Once you have your form set up, add the “Shortcode Variables” shortcode within
       your form. This shortcode acts as a placeholder for the user-provided values.
    4. Next, create a new page or post where you want to display the real estate search
       results.
    5. Within this page or post, add the regular IDX provider’s static shortcode for
       displaying SOLD data. But instead of entering fixed values for the search parameters,
       use the “Shortcode Variables” shortcode and the corresponding variable names
       you set in the form.
 * For example, your regular static IDX shortcode might look like this:
 *     ```wp-block-code
       [idx-listings city="your-city" beds="2" baths="2" sqft="1500"]
       ```
   
 * With the “Shortcode Variables” plugin, it could look like this:
 *     ```wp-block-code
       [idx-listings city="[city]" beds="[beds]" baths="[baths]" sqft="[sqft]"]
       ```
   
    6. When a user fills out the search criteria form on the front-end and submits 
       it, the form plugin will replace the variables with the user-provided values.
       These values will then be passed to the IDX shortcode, effectively generating
       a dynamic shortcode.
 * Please note that the specific plugin names and implementation details may vary
   based on your exact requirements, but the concept of using a “Shortcode Variables”
   plugin with a form builder remains the same. Make sure to thoroughly test the
   functionality after implementing it to ensure everything works as expected. If
   you’re not confident in setting this up yourself, you might consider seeking 
   the assistance of a WordPress developer to ensure a smooth integration.
 *  Thread Starter [jyonan](https://wordpress.org/support/users/jyonan/)
 * (@jyonan)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/dynamic-shortcode-builder/#post-16910154)
 * Thanks ( [@enigma123](https://wordpress.org/support/users/enigma123/) ) Enigma123,
 * Where do I find this plugin? I have done a couple of online searches with no 
   luck. Could you post a link for me???
 * Thanks again!!!
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/dynamic-shortcode-builder/#post-16910763)
 * [https://wordpress.org/plugins/search/shortcode+variables/](https://wordpress.org/plugins/search/shortcode+variables/)
   
   turns up a few promising plugins, along with a lot of false positives.
 * I know you’re not a developer, but IMO a straight PHP solution isn’t much more
   complicated than the solution Enigma123 suggested. Instead of
    `[idx-listings
   city="[city]"]` on the form results template you’d do `echo do_shortcode("[idx-
   listings city=\"{$_REQUEST['city']}\"]");` I’ve removed the other variables to
   keep things simpler, but the concept applies whether there’s one or a dozen.
 * TBH, the suggest PHP is an over-simplification. In reality we’d need to validate
   and sanitize form values prior to using the in a shortcode. There are other built-
   in functions to help with this. I’ve probably lost you now, but if you’re intrigued,
   you might be able to cobble together a PHP solution from examples without being
   an actual developer.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Dynamic Shortcode Builder?’ is closed to new replies.

## Tags

 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 3 replies
 * 3 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [2 years, 10 months ago](https://wordpress.org/support/topic/dynamic-shortcode-builder/#post-16910763)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
