Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /* It changes the order only for the main blog page */
- if ( ! function_exists( 't_n_order' ) ) :
- add_filter( 'pre_get_posts', 't_n_order' );
- function t_n_order( $query ) {
- if($query->is_home)
- $query->set( 'order' , 'asc' );
- return $query;
- }
- endif;
- /* It changes all over the site */
- if ( ! function_exists( 't_n_order' ) ) :
- add_filter( 'pre_get_posts', 't_n_order' );
- function t_n_order( $query ) {
- $query->set( 'order' , 'asc' );
- return $query;
- }
- endif;
- /* It changes the order for the main blog page, categories, tag pages and the other post archives */
- if ( ! function_exists( 't_n_order' ) ) :
- add_filter( 'pre_get_posts', 't_n_order' );
- function t_n_order( $query ) {
- if($query->is_home || $query->is_archive)
- $query->set( 'order' , 'asc' );
- return $query;
- }
- endif;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement