php - Filtering Search Results with Wordpress -


I'm trying to set up a search result page with two columns. The first column will present results of all categories except one (gallery), and the second column will only present the gallery category.

query_posts () simply resets my results This is what I have so far received. Broken:

  & lt ;? Php $ s = get_query_var ('s'); Query_posts ('s =' .s $ s '& amp; cat = 164'); ? & Gt; & Lt ;? Php / first loop? & Gt; & Lt; Div class = "contentLeft" & gt; & Lt; Ul class = "postlists related" & gt; & Lt ;? Php while (is_pos ()): the_post (); ? & Gt; [Accessories] & lt ;? Php timeline; ? & Gt; & Lt ;? Php // second loop? & Gt; & Lt ;? Php query_posts ('cat = -164'); ? & Gt; & Lt ;? Php rewind_posts (); ? & Gt; & Lt ;? Php while (is_pos ()): the_post (); ? & Gt; [Accessories] & lt ;? Php timeline; ? & Gt; & Lt ;? Php else:? & Gt; [Accessories] & lt ;? Php endif; ? & Gt;  

What to do?

I know this is an old post but I have such a problem and I think I shared Will:

  1. You are creating a query, then calling a second query, but then trying to rewind the query. It's not that take a look at how the Rewind function works: You also say:

query_posts () simply resets my results.

Then why are you calling the Rewind function immediately after the new query? Also, if you are resetting the result, then why is it entirely a different query? It:

$ s = get_query_var ('s'); Query_posts ('s =' .s $ s '& amp; cat = 164');

Not so:

   

To achieve the results of 2 columns for different categories, I did the following: Use only one loop, do not use rewind, for example if your loop is in a Use in the statement, then:

   name == "category name") {// insert the left div} else] add {{right}}?  

Hope it helps.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -