Timeline for How can i limit the number of posts to the most recent 6 in my query?
Current License: CC BY-SA 4.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 23, 2019 at 1:10 | review | Close votes | |||
Aug 6, 2019 at 3:05 | |||||
Jul 22, 2019 at 19:55 | comment | added | nmr |
By default, posts are sorted by publication date (you set this explicitly - 'orderby' => 'date' ), from newer to older.
|
|
Jul 22, 2019 at 18:58 | comment | added | Ben Blue | @mnr How do i ensure this is the 6 most recent posts? | |
Jul 22, 2019 at 18:56 | answer | added | Ben Blue | timeline score: 0 | |
Jul 22, 2019 at 18:52 | comment | added | Ben Blue | thank you - i just found out that the staging site and production site are out of sync, and the production site had 'posts_per_page' => -1,`. Changing that to 6 fixed it! I didn't get to try your solution, but thank you. | |
Jul 22, 2019 at 18:29 | comment | added | nmr |
Comment $related_posts = new WP_Query($args); line, set 'posts_per_page' => 6, and belowe ul tag replace all $related_posts-> to $all_posts-> .
|
|
Jul 22, 2019 at 18:19 | history | asked | Ben Blue | CC BY-SA 4.0 |