Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created December 29, 2011 19:47
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 billerickson/1535891 to your computer and use it in GitHub Desktop.
Save billerickson/1535891 to your computer and use it in GitHub Desktop.
<?php
add_action( 'pre_get_posts', 'be_tag_sort_order' );
/**
* Change the post order for certain tags
*
* @author Bill Erickson
* @link http://www.billerickson.net/customize-the-wordpress-query/
* @param object $query data
*
*/
function be_tag_sort_order( $query ) {
if( $query->is_main_query() && $query->is_tag( array( 'genesis-explained', 'actions', 'filters', 'functions', 'admin' ) ) ) {
$query->set( 'orderby', 'date' );
$query->set( 'order', 'ASC' );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment