Display posts of past 7 days broken down by cateogry
-
Hi,
I’m looking to create a shortcode function that displays all posts of the past 7 days (not including the day of the post) broken down by category. Basically, it’s a post that would go up every Monday morning that’s a wrap up all off posts from the previous Monday-Sunday. I want to make it a shortcode so that the user can write the intro paragraph and then type the shortcode to generate the post.
How would I go about doing this? I’m not quite sure how to query the posts so that it only pulls from the past 7 days of the publish date (so that if a reader visits the post a week later, it’s not 7 days from when they visit the post, but 7 days from the publish date). Then I’m not sure the best way to loop through to display the category name in an “h4” tag with an unordered list of all post from that category in the previous week.
Any help would be GREATLY appreciated!
Thanks,
Matt
- The topic ‘Display posts of past 7 days broken down by cateogry’ is closed to new replies.