Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Is there an easy way to reverse the default item order of a category rss feed?

Default: Last posted item first
Wanted: First posted item first

No plugins please, plain wp api function calls (such as add_action or add_filter) will do!

share|improve this question
1  
"plain wp php" is a plugin or a theme or any other bit of functionality that you add outside of WordPress' core. –  chrisguitarguy Nov 29 '12 at 20:23
    
REALLY? Oh wow that is amazing! –  mahatmanich Nov 29 '12 at 20:35
add comment

2 Answers

In your functions.php file

function reverseorder($query_string)  
{
    return query_posts( $query_string . '&order=ASC' );
}
add_action( 'rss2_head', 'reverseorder' );

EDIT

GET parameters on RSS feed
cat - category ID (e.g. 23)
author - author ID (e.g. 14)
year - year the post was published (e.g. 2007)
day - day of the month the post was published (e.g. 17)
monthnum - number of the month the post was published (e.g. 6)
hour - hour of the day the post was published (e.g. 23)
minute - minute of the hour the post was published (e.g. 48)
second - second of the minute the post was published (e.g. 51)
p - the unique post ID to display (e.g. 629)
paged - specific page number as displayed on the main blog page (e.g. 3)

share|improve this answer
    
@mahatmanich Who is your comment for up there? If it worked, please mark as correct answer. –  Chris Nov 29 '12 at 20:50
    
The comment was for the other Chris that was being a smart alec. I am still looking at the solution you posted here however it does not quite work in my instance! –  mahatmanich Nov 29 '12 at 22:35
    
Basically you need to reverse the order of the feed-rss2.php file using that action on line (36?) –  Chris Nov 30 '12 at 0:31
    
Actually I could just use the GET parameter when calling the feed couldn't I? –  mahatmanich Nov 30 '12 at 1:47
    
Hmm, to my knowledge ordering of RSS feed is not a get parameter. –  Chris Nov 30 '12 at 2:12
show 2 more comments
up vote 0 down vote accepted

You can simply reorder you RSS Feed via the GET parameter ?order=ASC or ?order=DESC after your FEED url!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.