Skip to content

Instantly share code, notes, and snippets.

@halgatewood
Created September 1, 2015 18:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save halgatewood/11f4121d5d739721f1aa to your computer and use it in GitHub Desktop.
Save halgatewood/11f4121d5d739721f1aa to your computer and use it in GitHub Desktop.
Testimonial Rotator Archive Page Order By. Add this function to your functions.php file in your theme.
add_action( 'pre_get_posts', 'hg_change_testimonial_sort_order');
function hg_change_testimonial_sort_order($query)
{
if( is_main_query() AND is_post_type_archive('testimonial') )
{
$query->set( 'order', 'DESC' );
$query->set( 'orderby', 'date' );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment