PluginProbe
Chronological Posts / trunk
Chronological Posts vtrunk
chronological-posts / chronological-posts.php

chronological-posts.php in Chronological Posts trunk, at chronological-posts.php

38 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: Chronological Posts
4 * Plugin URI: https://celloexpressions.com/plugins/chronological-posts/
5 * Description: Globably reverses the post order to be chronological, so that your site can display a journal or a book in chronological order.
6 * Version: 1.1
7 * Author: Nick Halsey
8 * Author URI: https://celloexpressions.com/
9 * Tags: post order, chronological, reverse post order
10 * License: GPLv2
11
12 =====================================================================================
13 Copyright (C) 2026 Nick Halsey
14
15 This program is free software; you can redistribute it and/or
16 modify it under the terms of the GNU General Public License
17 as published by the Free Software Foundation; either version 2
18 of the License, or (at your option) any later version.
19
20 This program is distributed in the hope that it will be useful,
21 but WITHOUT ANY WARRANTY; without even the implied warranty of
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 GNU General Public License for more details.
24
25 You should have received a copy of the GNU General Public License
26 along with WordPress; if not, write to the Free Software
27 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28 =====================================================================================
29 */
30
31 if ( ! defined( 'ABSPATH' ) ) exit;
32
33 add_filter( 'pre_get_posts', 'reverse_post_order_pre_get_posts' );
34 function reverse_post_order_pre_get_posts( $query ) {
35 if ( ! is_admin() && $query->is_main_query() ) {
36 $query->set( 'order', 'ASC' );
37 }
38 }