Reputation: 373
I have duplicate the index.php page and called it old.php.
Then I replace the query_posts();
for query_posts( $query_string . '&order=ASC' );
.
I want to be able to use index.php as the normal wp home page and the old.php to show posts in reverse order. ( think you understand my ideia )
How do I call old.php with pretty urls so visitors can view list of posts in reverse order?
Upvotes: 0
Views: 2028
Reputation: 5487
Do you really need to place it in a separate PHP file? If the only difference between index.php
and old.php
is the order of which the posts are displayed, you can just use index.php
alone, and just pass in the ordering as a parameter:
index.php
$order = 'DESC';
if (isset($_GET['order']) and $_GET['order'] == 'reversed') {
$order = 'ASC';
}
$posts = query_posts($query_string . '&order=' . $order);
This will display the posts in reversed order if your URL looks something like /index.php?order=reversed
(still looks pretty).
Upvotes: 1