• 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

Viewing 4 replies - 16 through 19 (of 19 total)
  • Hi, vtxyzzy !
    9 months passed since the last time we communicate … but until this day, I remember the great help you gave me.
    Today, as could not be otherwise, I return with a new question.

    I am using the code you gave me, this code shows the new POST in the NEW WEEK, past the OO: OO pm on Thursday. The problem is, this is being guided by the server time, not the schedule that I set up in WordPress. (-3 GMT) …

    This code could work with the assigned times in the configuration of wordpress?

    Thanks!

    I think you can get what you want by replacing this line:

    $date = date('Y-m-d');

    with this:

    $date = date('Y-m-d',current_time('timestamp'));

    A second to reply!, Thank you very much ..

    I will try this code that you suggest. Then I commented that passes, the next Thursday …

    Regards!

    00hs! The code works perfectly!
    Have a good new year …

    Thanks again ….

Viewing 4 replies - 16 through 19 (of 19 total)
  • The topic ‘Display posts of past 7 days broken down by cateogry’ is closed to new replies.