How to query the recent posts of the last two days of the week
-
Hi, I’m trying to display in one section of my front page my latest posts from the last two days. The idea is to display a quick view of this week’s posts but just show the latest two past days and just the latest two posts of each day.
So basically what I want to do is for example:
Yesterday Date | -> last two posts with title, thumb, category.
The day before Yesterday Date | -> last two posts with title, thumb, category.
–> and link to see the whole week’s posts.
So I tried doing a query, but after some hours of research and trial&Error. I was only able to display the day before yesterday’s post.
This is the query I’m using:
<?php $arc_year = get_the_time('Y'); $arc_month = get_the_time('m'); $arc_day = get_the_time('d'); query_posts( 'year=' . $arc_year . '&month=' . $arc_month . '&day=' . $arc_day . '&showposts=2'); if (have_posts()) : while (have_posts()) : the_post();?>
I have no idea how to solve this, if someone can help me out I would really appreciate it, thanks!
snapshoots (sorry dates are in spanish):
what I want:
http://swebdevelopment.com/clients/weekspost.pngwhat I have:
http://swebdevelopment.com/clients/sofar.png
- The topic ‘How to query the recent posts of the last two days of the week’ is closed to new replies.