review http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts
example code (to be added into functions.php of a child theme):
function reverse_order_posts( $query ) {
if ( is_admin() || ! $query->is_main_query() ) return;
$query->set( 'order', 'ASC' );
return;
}
add_action( 'pre_get_posts', 'reverse_order_posts', 1 );
untested.
http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters
I’m a little confused.
Are you saying in the file:
/WordPress/wp-content/themes/twentythirteen/functions.php
I need to add:
function reverse_order_posts( $query ) {
if ( is_admin() || ! $query->is_main_query() ) return;
$query->set( ‘order’, ‘ASC’ );
return;
}
add_action( ‘pre_get_posts’, ‘reverse_order_posts’, 1 );
Does it have to be at a certain point in the file functions.php?
Thanks for your quick rep;y
Tried what was showed above — Did not work.
Please Clarify
1. Yes /WordPress/wp-content/themes/twentythirteen/functions.php is the correct file to edit.
2 Please show the exact code & location in file
the suggested method works for me.
make sure to clear any caches.
however, rather than editing the files of the theme Twenty Thirteen directly, create a child theme for the customizations.
https://codex.wordpress.org/Child_Themes
then add the suggested code into functions.php of the chld theme.
can you post a link to your site with the suggested code in place?
This is my site http://keelhauler.org/WordPress/
It’s in standard blog order but after the trip I want it in reverse order.
I’ll have to read your child_themes info carefully and see what I ave to create and where to I place the files.
Thanks again for fast reply
http://keelhauler.org/WordPress/?cat=14
Is the blog page I’m trying to reverese.
I created directory /WordPress\wp-content/themes/twentythirteen-child
Files:
style.css
/*
Theme Name: Twenty Thirteen Child
Theme URI: http://wordpress.org/themes/twentythirteen-child
Author: the WordPress team & JK
Author URI: http://wordpress.org/
Description: Twenty Thirteen Child Theme
Version: 1.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: twentythirteen-child
*/
functions.php
function reverse_order_posts( $query ) {
if ( is_admin() || ! $query->is_main_query() ) return;
$query->set( 'order', 'ASC' );
return;
}
I must need something else
It worked, thanks so much. I just needed to read everything more carefully.
http://keelhauler.org/WordPress/?cat=14
But I need to change my picture header again.