Last active
December 6, 2015 05:17
-
-
Save ayezee33/e74baea6b57189c6666e to your computer and use it in GitHub Desktop.
Reverse order posts in wordpress
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
//Reverse Podcast Order | |
function podcast_order( $wp_query ) { | |
// Get the post type from the query | |
if( isset($wp_query->query['post_type']) ) { | |
$post_type = $wp_query->query['post_type']; | |
if ($post_type == 'podcasts') { | |
$wp_query->set('orderby', 'date'); | |
$wp_query->set('order', 'ASC'); | |
} | |
} | |
} | |
add_filter('pre_get_posts', 'podcast_order'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment