Support » Fixing WordPress » Reversing the order of the 'Recent Posts' widget

  • Resolved DylanR


    Attempting to Google this has broken my brain, but I ain’t too proud to beg.

    Hi all, I’m looking for a way to reverse the ordering of the default WP Recent Posts widget. Currently, the latest post is shown at the top of the widget. I want this to be reversed so that the oldest post shows first.

    To give this some context (I’m afraid I must deny you seeing the patient, visiting hours have not yet begun), I have a widget that shows upcoming events using future posts dispensed by the recent posts widget.

    Once a post is published, it is removed from the widget

    So what I want is for the widget to show the 5 most imminent posts to be published, in descending order (1st Jan, 2nd Jan, 3rd Jan, etc.)

    Is this at all possible?

    I don’t want this to be universal for my site though, just the widget. There will be a page in which the events MUST be shown in reverse-chronological order

    Thanks in advance!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi Again, all

    Just in case anyone finds this with the same issue:

    My solution was to add the following code to my WP_Query:

    'orderby' => 'date', 'order' => 'ASC'

    I added this in the array for query arguments



    DylanR, I want to do the same thing, but I don’t understand what a WP_Query is. I’m new to programming, can you point me in the right direction? Is is a file or an array in a file, and if so what file? Thank you for your time and knowledge.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Reversing the order of the 'Recent Posts' widget’ is closed to new replies.