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.

Every wp page has link structure like http:/site.com/?paged=1,2,3..50(last)

But how exchange it on http:/site.com/?paged=50,49,48..1(last)

share|improve this question
1  
Question is not clear. –  Denis Dec 12 '10 at 22:10
1  
why would you want to do that? database starts counting from 1, and not from some number... how would you decide from which number to start? –  pootzko Dec 12 '10 at 22:29
    
@Michail: I assume you are talking about paged lists, like archives? You want the earliest post always on the page numbered "1", so they stay the same, even if new posts appear? (Otherwise they get moved to next pages, which might be confusing if you follow an older link) –  Jan Fabry Dec 13 '10 at 7:50
add comment

1 Answer

I think you can achieve this by first reversing the sorting order (filter posts_orderby), and then reversing the selected posts (filter the_posts). By doing this double reverse you circumvent the problem that you have to know the number of posts your query will return before you execute the query.

Keep in mind that WordPress (I think via the canonical rewriter) will remove the /page/1 part of your URL, so you should prevent this from happening. Also sticky posts might need attention. See the code for WP_Query::get_posts() for hooks to change the post query.

share|improve this answer
add comment

Your Answer

 
discard

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