Change post order to Ascending mode

Add the following snippet to wp-content/themes/[yourtheme]/functions.php

 

if ( ! function_exists( 'yit_change_post_order' ) ) :
/**
 * Change post order
 * 
 * @param object $query The current query
 */
function yit_change_post_order( $query ) {
	$query->set( 'order', 'ASC' );
}
add_action( 'pre_get_posts', 'yit_change_post_order' );
endif;
Was this article helpful?
0 out of 0 found this helpful

Back to Help Center

Powered by Zendesk