Timeline for Why I can't get old posts instead of recent with WP_Query?
Current License: CC BY-SA 3.0
20 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 12, 2015 at 16:23 | vote | accept | Elías Gómez | ||
Aug 12, 2015 at 14:03 | comment | added | webtoure | @cybmeta Thank you for being the one clearing this up. To my disappointment, another privileged user on this thread didn't want to make it clear that this is the final correct solution and somewhat deepened the confusion with another answer as if this one wasn't correct. | |
Aug 12, 2015 at 13:55 | comment | added | cybmeta |
@EliasNS you are confusing me; a lot. From your question and your comments, this is the answer to your problem. Even you have said that the solutin is to user the order parameter. But it seems that we don't understand you at all. Also, you are incorrect in the explanation of why this answer is not 100% correct. The order parameter is set to DESC by default, It doens't matter if you want to order the results or not, they are ordered already but to make WP_Query work as you want you HAVE TO CHANGE IT TO ASC . That's all and that is what webtoure said to you and what solved your problem.
|
|
Aug 12, 2015 at 12:14 | history | edited | webtoure | CC BY-SA 3.0 |
added 133 characters in body
|
Aug 12, 2015 at 12:08 | comment | added | Elías Gómez | I don't understand what you mean. Your first phrase is wrong and is not necessary. The 'order' part is right. I don't know what you say that 'after in time' means older, and not fixing it. If I buy a shirt 'after in time' that a shoes, the shirt is newer than the shoes. | |
Aug 12, 2015 at 11:58 | comment | added | webtoure |
@EliasNS Mon Dieu! That (along with the order clause of course) is the exact part that makes it work accordingly with your attached image.
|
|
Aug 12, 2015 at 11:43 | comment | added | Elías Gómez | @webtoure Not, the 'after' part is wrong (it gets posts published AFTER the date, so newer and no older), and the example is not related with the question. If you delete or fix that part I'll mark the answer. And of course, thanks for the time and the discusion, that solved my problem =D | |
Aug 12, 2015 at 11:28 | comment | added | webtoure | @EliasNS I think you will find that my very first edit was perfectly fine and we just wasted a lot of time with you not bothering to even test the solution. ;) | |
Aug 12, 2015 at 11:27 | comment | added | Elías Gómez |
@cybmeta I'm sorry but I think that the discussion solved my problem, not this concrete reply. Also, it has incorrect information about 'after' .
|
|
Aug 12, 2015 at 11:24 | comment | added | cybmeta | @EliasNS don't forget to mark this answer as accepted if it solved your problem. | |
Aug 12, 2015 at 11:21 | comment | added | Elías Gómez | @webtoure Tested and working. Sorry and let me explain in my question :p | |
Aug 12, 2015 at 11:13 | comment | added | webtoure |
@EliasNS Use the order clause. End of story. :)
|
|
Aug 12, 2015 at 11:12 | history | edited | webtoure | CC BY-SA 3.0 |
deleted 169 characters in body
|
Aug 12, 2015 at 10:58 | comment | added | Elías Gómez |
@webtoure I stablish a future date, but I use a plugin called No Future Posts , so the posts never gets the future status, always are publish . I'm going to post an image to clarify.
|
|
Aug 12, 2015 at 10:50 | comment | added | webtoure | @EliasNS I have updated my response, you are using future publish posts if I understand correctly and this was not obvious from your question. | |
Aug 12, 2015 at 10:48 | history | edited | webtoure | CC BY-SA 3.0 |
added 118 characters in body
|
Aug 12, 2015 at 10:20 | comment | added | Elías Gómez |
I know the order parameter, that is not what I want to do. I have added information about it in my question. After gets newer posts, not older (after the date especified): Codex. $wp_query was only an example (bad one) and is not my real variable. @cybmeta 30 days is not always a month.
|
|
Aug 12, 2015 at 9:26 | comment | added | cybmeta |
Good answer. I would add that date_query accepts relatives dates. For example 'after' => '-30 days' for last month.
|
|
Aug 12, 2015 at 9:23 | history | edited | webtoure | CC BY-SA 3.0 |
added 109 characters in body
|
Aug 12, 2015 at 9:10 | history | answered | webtoure | CC BY-SA 3.0 |