Timeline for Sorting posts according to the term they belong to
Current License: CC BY-SA 3.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Dec 21, 2015 at 21:07 | comment | added | Pieter Goosen | FINALLY FINALLY, I have posted a working solution. Feel free to check out my answer | |
Dec 21, 2015 at 13:17 | comment | added | Pieter Goosen | I haven't forgotten about you, I'm already halfway. I'm just horribly busy. I will hopefully have te answer finished by tonight | |
Dec 21, 2015 at 8:48 | comment | added | Pieter Goosen | No problem, give me an hour or two, I'm just stuck on something else at the moment | |
Dec 21, 2015 at 8:43 | comment | added | Ana DEV | could you post an answer so i coold see the whole view please @PieterGoosen | |
Dec 21, 2015 at 8:42 | comment | added | Pieter Goosen | Also, make use of transients to store data from queries like this | |
Dec 21, 2015 at 8:41 | comment | added | Pieter Goosen |
Query all posts as you have done in your question, then use usort to sort the result of $posts . Just a tip, never ever use $wp_query as a local variable. $wp_query holds the main query object which is very important to a huge amount of functions, breaking the vaue of $wp_query breaks all those functions. So if you use $q = new WP_Query( $args ); , you would use usort() to sort the results of $q->posts
|
|
Dec 21, 2015 at 8:24 | comment | added | Ana DEV | so what you suggest @PieterGoosen ? | |
Dec 21, 2015 at 8:03 | comment | added | Pieter Goosen | That is EXTREMELY expensive, you are probably running about 150 db queries just on a relatively small site with only a few terms and posts | |
Dec 21, 2015 at 8:00 | history | answered | Ana DEV | CC BY-SA 3.0 |