Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

This is somewhat of a follow-up to a question I asked some time ago: Trying to design nice category drilldown with one "held" taxonomy and a repeatable list of categories

I've sort of got a better idea of what I want, but only a vague idea of how to accomplish it and I was hoping to get some feedback.

I'm going to be using wordpress as a CMS. Instead of posts with blog-type info, I'd be making Products with a number of shared properties (which I'd assign to taxonomies). I want to create a good search/navigation area for people to be able to find the Product Info/Review that they want. Really something like New Egg (www.newegg.com) has when you try and find a piece of computer equipment you want. Were you go in and start in say the Processor category, and then you can drilldown to what you want. All the posts with the 3GHZ taxonomy. The Search box would adjust then to show all those posts and the remaining taxonomies you could drill down by, socket type, AMD/Intel etc... and have it hold on to those properties as you pass through.

I know I can use either cookies or a session to hold the values as I pass down through them, but not entire sure how to approach the rest of the code.

I'm looking for any open source examples I might be able to look through where this has been done before that would help me develop something like this for my site.

Thanks in advance!

share|improve this question

1 Answer 1

up vote 2 down vote accepted

There's a way to set custom post-type search. I can only head you in the right direction and answer the first part of your question. The other part about COOKIES you'll have to review php documentation.

Also, I don't know exactly what the other $_REQUEST variables you may have set for your custom post type.

But here's a technique on how you can hidden input fields to set various post/get/request values.

I.E. Here is how you set which custom post type:

<form role="search" method="get" id="searchform" action="<?php echo home_url( '/' ); ?>">
<input type="text" name="s" id="s" value="Enter keywords ..." onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;"/><br />
<select name="post_type">
    <option value="">Choose Category:</option>
    <option value="">All Categories</option>
    <option value="post_type_a">Post Type A</option>
    <option value="post_type_b">Post Type B</option>
     <option value="post_type_c">Post Type C</option>
</select><br />
<input type="submit" id="searchsubmit" value="Search Help" />

Thus when you submit the value the search will add $_REQUEST['post_type'] to your search.

You can also do this with a hidden form:

<input type="hidden" name="post_type" value="your_post_type" />

and have javascript dynamically change the value of above field.

More on this:

So potentially you could just add another hidden field to limit your search with javascript etc.

Hope that helped!

share|improve this answer
1  
Hey Chris, sorry I didn't get back to you sooner, I was out of town for a few days. For this particular project I actually decided to simplify my thinking on the search functionality. I found I was making things overly complex for this project and when I dumbed down the complexity, I still got all the functionality I wanted. However, your answer is a great one and I will definitely keep it in mind for future projects! Thanks for taking the time to respond! –  Duiwel May 26 '11 at 5:14
    
No problem! Always looking to help! –  chrisjlee May 26 '11 at 17:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.