wordpress - woocommerce search only parent category products based on body class -


I am using the code given below but I'm not sure how to add it to two different search forms The categories of products that only parents search in. Either product_parent_cat_floral or product_parent_cat_rentals

  & lt; Php $ classes = get_body_class (); If (in_array ('product_parent_cat_rentals', $ square)) {? & Gt; // Rent search form goes here & lt ;? Php} else {? & Gt; // flower search form goes here & lt ;? Php}? & Gt;   

Can I search this search form anyway in the Apprentice Parent class?

  & lt; Form role = "search" method = "get" id = "search form" = "http://botanicaevents.com/rentals/" & gt; & Lt; Div & gt; & Lt; = "S" for label class = "screen-reader-text" & gt; Search for: & lt; / Label & gt; & Lt; Input type = "text" value = "" name = "s" id = "s" placeholder = "search for products" / & gt; & Lt; Input type = "submit" id = "searchsubmit" value = "search" /> & Lt; Input type = "hidden" name = "post_type" value = "product" /> & Lt; / Div & gt; & Lt; / Form & gt;    

I think you can use just: < Pre> & lt; Input type = "hidden" name = "product_kat" value = "rent" />

Then your search query is created:

 ? S = some + search + string & amp; Post_type = product and product_cat = rent   

additionally to restrict search within the rental product category.

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -