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.

I would like to reverse the pagination order for the category archives and am wondering if anyone can offer any help.

Basically what I am looking for is pagination to start with the oldest post first, but browsing to start with the newest post, in effect reverse pagination and then browsing starting with the highest numbered page first.

I have tried reversing the sort order but does not work for 2 reasons

  1. Displays page 1 first.
  2. The posts in the pages are in reverse order as well, oldest first.

I tried the code offered here: Help With A Reverse Pagination Plugin

I don't know if I was missing something but it appeared to just give the same results as reversing sort order.

I also tried messing with modifying the get_next_posts_link() function, but came to the realization that would just effect browsing, not the actual pagination.

A similar question is outlined here: How to implement pagination in backward way eg. first - 20 - 19 - 18 - ... - 3 - 2 - 1 - last

This thread in a Drupal forum seems to illustrate additional reasons why this would be useful: http://drupal.org/node/143719

Another reason why I thought this would be useful would be because it would allow the user to see how much content is available without having to find the end, like having a reverse counter on a video so you know how long it is before beginning to watch.

Does the solution to the problem require messing with rewrite rules? Any input would be appreciated.

share|improve this question
    
I don't understand this. Your conditions seem to conflict with one another. –  s_ha_dum Feb 6 '13 at 23:57
    
For example if there are 5 posts with the # of posts per page set to 3, browsing would look like this: PAGE 2 (Post 5, Post 4) -> PAGE 1 (Post 3, Post 2, Post 1) If you simply reverse sort order you get: PAGE 1 (Post 1, Post 2, Post 3) -> PAGE 2 (Post 4, Post 5) –  user27068 Feb 7 '13 at 0:27
    
Also if you were to simply reverse the pages after reversing the sort order you would get: PAGE 2 (Post 4, Post 5) -> PAGE 1 (Post 1, Post 2, Post 3) –  user27068 Feb 7 '13 at 0:31

1 Answer 1

If you want people to be able to see how many content there is and to be able to navigate to the last page then simply use page navigation plugin. If it is realy important for the pages to be in reverse order then you can edit the display code in the plugin to achieve that.

Otherwise, it can be done but you need to handle switching the sort order in the query several times depending on context, or write your on sort algorithm to sort the posts before displaying them.

Note: unless you have a very special need, SEO is the worst reason to do anything like that as the content of those pages is generated dynamically and it is usually recommended to instruct search engines to not index them.

share|improve this answer

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.