Created
September 1, 2015 18:22
-
-
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.
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_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