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 of how you can set it up:
- Install and activate the “Shortcode Variables” plugin from the WordPress plugin repository.
- 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.
- 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.
- Next, create a new page or post where you want to display the real estate search results.
- 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:
[idx-listings city="your-city" beds="2" baths="2" sqft="1500"]
With the “Shortcode Variables” plugin, it could look like this:
[idx-listings city="[city]" beds="[beds]" baths="[baths]" sqft="[sqft]"]
- 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
(@jyonan)
Thanks ( @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!!!
https://ww.wp.xz.cn/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.