Custom Query Using Custom Fields and Multiple Tags
-
I am working on a real estate blog. Each post has a custom field called Maximum Guests, which is assigned a value between 1-20. The number of guests is also included in each post content and post excerpt in a standard format. Each post is tagged with its amenities (i.e. Deck, Fireplace, Pets Allowed, Ocean View, etc).
When a site visitor searches, they can choose the total number of guests and types of amenities they are looking for (see http://estesparkrentals.allyourssolutions.com for example). I need a query that will pull posts with:
Number of guests (if visitor inputs 4, the query needs to display posts that specify 4,5,6,7…20 guests)
AND
Multiple amenities selectedFor instance, a visitor wants a property for 6 people that has a deck and fireplace… how can I make this work?
[code]
query_posts(tag=deck+fireplace);
[/code]works to effectively pull the desired amenities. Then I tried to use $pos = strpos($excerpt, $findme); in conjunction with get_the_excerpt() to scan the excerpt for the max number of guests. However, if it’s given 6, it ONLY pulls posts with Maximum Guests 6, not 6,7,8,9,10,11…20.
Any ideas? Thank you for your time!
-
You did not specify a blog address or reason for posting when you created this topic.
This support forum is for blogs hosted at WordPress.com. If your question is about a self-hosted WordPress blog then you’ll find help at the WordPress.org forums.
If you don’t understand the difference between WordPress.com and WordPress.org, you may find this information helpful.
If you forgot to include a link to your blog, you can reply and include it below. It’ll help people to answer your question.
This is an automated message.
- The topic ‘Custom Query Using Custom Fields and Multiple Tags’ is closed to new replies.