The AgentPress theme from StudioPress is a very nice theme, but it’s not always apparent how to set up your client’s site to look like the demo.
One example is the form titled “Contact Us About This Property” that shows up at the bottom of each property listing.
The demo does let us know that the form uses the Gravity Forms plugin. If you’ve used Gravity Forms before, it’s pretty straightforward to set up all of the form fields, except for one: the “Which Property Are You Interested In?” dropdown.
Now, manually setting up the options for a dropdown field like this in Gravity Forms is fairly simple, but when you’re managing multiple listings, setting up these options for every listing is going to get really old really quick. Unfortunately it doesn’t look like there’s a way to make the dropdown menu dynamic based on your listings.
So the solution I came up with was to just ditch the dropdown field. Honestly, I’m not sure what value it adds. The person submitting the form is going to be interested in the property on the page 99% of the time.
But if we ditch the dropdown, we still need a way for the form to tell us which property the user was viewing when submitting the form. The answer is to use a hidden field in the form.
I actually set up two hidden fields, one for the name of the listing and one for the URL of the listing.
To do this, go into Gravity Forms in the WordPress admin and add a couple of hidden fields to the form. For the first field, under “Field Value,” give it a name (I used “Listing viewed”), and then under the Advanced tab, pull down the “Insert variable” dropdown and choose “Embed Post/Page Title.”
For the second field, give it a name as well, and under Advanced, choose “Embed URL” from the “Insert variable” dropdown.
Now when someone fills out the “Contact Us About This Property” form, the name of the property and the URL of the listing will automatically be added to the form.
Connect