Skip to content

Instantly share code, notes, and snippets.

@robneu
Last active December 19, 2015 10:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save robneu/5940779 to your computer and use it in GitHub Desktop.
Save robneu/5940779 to your computer and use it in GitHub Desktop.
Reverse the post order for the Genesis Framework
<?php
add_action( 'pre_get_posts', 'prefix_reverse_post_order' );
/**
* Reverse Post Order for Post Archives
* on the Genesis Framework
*
* @author FAT Media
* @link http://youneedfat.com/reverse-post-order-genesis-framework/
* @param object $query data
*
*/
function prefix_reverse_post_order( $query ) {
if ( is_admin() )
return;
// Only change the query for post archives.
if ( $query->is_main_query() && is_archive() && ! is_post_type_archive() ) {
$query->set( 'orderby', 'date' );
$query->set( 'order', 'ASC' );
}
}
@robneu
Copy link
Author

robneu commented Jul 6, 2013

You can check out a full breakdown and explanation of this Gist on our blog: http://youneedfat.com/reverse-post-order-genesis-framework/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment