-
-
Save itsjusteileen/0c4b27e845f3bba63d348a3ff180f0d6 to your computer and use it in GitHub Desktop.
Wordpress Reverse Order Posts in Category Archive
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Add lines five to 10 to your child theme's functions.php file | |
*/ | |
function change_category_order( $query ) { | |
if ( $query->is_category('8') && $query->is_main_query() ) { | |
$query->set( 'order', 'ASC' ); | |
} | |
} | |
add_action( 'pre_get_posts', 'change_category_order' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment