Timeline for Stuck in the query loop
Current License: CC BY-SA 3.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 7, 2015 at 18:39 | answer | added | Hybrid Web Dev | timeline score: 0 | |
Jan 7, 2015 at 17:21 | comment | added | Amir | Alright @kaiser, i just updated my code with less code and cleaner loop. So the thing which i want is just show the category nam when the field "buy_online_href" has value. But i can't figure it out how. | |
Jan 7, 2015 at 17:20 | history | edited | Amir | CC BY-SA 3.0 |
deleted 570 characters in body
|
Jan 7, 2015 at 0:14 | comment | added | Tom J Nowell♦ |
+1 to avoiding query_posts
|
|
Jan 7, 2015 at 0:13 | comment | added | kaiser |
Ok, I read through the code and there's one obsolete/nothing-matching } /closing bracket at the end. I saw a bunch of missing ; /semicolons and as @mrwweb already suggested, you are destroying & overwriting the main query with your query_posts() once per loop. Do you have debugging enabled (see Codex about that)? And do you have short PHP tags on your server enabled? Update your question (instead of commenting) with your answers. And please: Fix intending your code. That is highly unreadable that way.
|
|
Jan 7, 2015 at 0:05 | comment | added | kaiser |
Hint: When you replace the : endforeach and : endif etc. with proper curly brackets {} , then with an IDE one will be able to quickly look at your code to see if there's something missing.
|
|
Jan 6, 2015 at 22:32 | comment | added | mrwweb |
There are a lot of small issues here and I'd recommend cleaning them up if you want to get a good answer. 1) Use proper full <?php openings. 2) Clean up the indenting of your code so it's readable. This in fact may show you where your look is going wrong. 3) query_posts() is evil! Don't use it! Use pre_get_posts or WP_Query instead. Google all three to learn the differences. 4) This may be your issue, but I don't see any endforeach for your foreach loop.
|
|
Jan 6, 2015 at 22:26 | history | edited | mrwweb | CC BY-SA 3.0 |
spelling / grammar
|
Jan 6, 2015 at 22:01 | review | First posts | |||
Jan 6, 2015 at 22:26 | |||||
Jan 6, 2015 at 22:00 | history | asked | Amir | CC BY-SA 3.0 |