Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Mahesh Sangam
Mahesh Sangam
71 Points

Need Custom Search for Real Estate Site.. on front page with Property Type, Location & Price Range dropdown...

I kindly need help or guidance adding a custom search on the home page. It's a real estate site so client wants visitors to be able to search the site with only the 3 variables: type of properties, location and Amount

I'm a complete newbie and I'm not yet sure how to pull it off. It would be great if you can help me find what I need here.

Thank you so much, in advance.

George Kuka
George Kuka
2,673 Points

I'm a little worried you said this is for a client, but that's beside the point. For starters since I assume your client will want to easily add additional properties and you want to search within these fields I'd recommend first going through the Treehouse PHP courses and then the WordPress Theme course. In the WordPress course you'll learn how to go about creating "custom post types" which in your case could be real estate properties. These custom post types will have fields (price, location, type, etc) that you can customize to your liking and then with some work be searchable. But like I mentioned in the beginning, at the very least get the PHP basics down, then start looking at the WordPress courses.

Good luck, take it slow and have fun.

5 Answers

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

If you're a complete newbie this is not going to be an easy task at all, and a potentially complex process.

One approach would be have the search link to a custom results page and add the variables as parameters. Then you can pass them to WP_Query to display the results.

If none of this makes sense or rings a bell, I would agree with the first poster that you may have bit off more than you can choose for a paying client.

Mahesh Sangam
Mahesh Sangam
71 Points

Im not happy with the response... Sir why don't you create one course on TeamTreeHouse (Create Search Fields on Front Page of Real Estate Site with custom post types - like http://propertyfirst.in)...

im not that new to this WordPress i made themes and also worked in PHP Code... im in quick and i really no idea how to develop search fields worked as per my real estate site....

please some one help me with perfect tutorial to build search fields for real estate front page...

George Kuka
George Kuka
2,673 Points

Your last sentence pretty much sums up why he hasn't done that. Because it's a perfect tutorial for your one specific situation. You say you have made themes, worked in PHP code, and you can't figure out how to create custom searches using wp_query by browsing the documentation?

Read this WP_Query Docs, it will show you what you need to know.

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

Hi,

A couple of things.

  1. You have a quite complex problem to solve
  2. As the other student points out, this wouldn't really be a good course because it is too specific, plus by the time the course came out it may be too late to help
  3. I'm glad you already know PHP and WP, that will help.

What do you think about the approach of creating three fields and pushing their values into url parameters that you can pull back down into WP_Query. Do you think it won't work or are you just unsure how to do this type of thing?

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

Also have you searched around for WordPress custom search plugins that allow for mutiple search fields? There are a couple of premium and free plugins that extend the default search capabilities and you might find an easy win. I don't know of one off hand but that doesn't mean one doesn't exist :)

Mahesh Sangam
Mahesh Sangam
71 Points

George Kuka & Zac Gordon Sir im sorry for my last post... i really don't want to use ready made product i want to learn but im in middle of my site and i really don't ahve time to learn right now and even create my self php coded plugin... yes i searched in google about this type of search fields i found one

Real Estate Agent Search Property Listings WordPress Plugin: 1) Easy Property Listings 2) WPL Real Estate

Thanks a lot for WP_Query i will sure invest my time on this and i try my self to develop this search field by using my php development knowledge... have a great day sir..