Last active
April 29, 2021 10:04
-
-
Save wpserve/6f1bdd61bc1ae463c2d8780918197f10 to your computer and use it in GitHub Desktop.
Modifying WordPress Loop for Custom Tax
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
<?php | |
add_action( 'pre_get_posts', 'stepasyuk_custom_wp_query' ); | |
function stepasyuk_custom_wp_query( $wp_query ){ | |
if( $wp_query->is_main_query() && $wp_query->is_tax('categories-formations') ){ | |
$wp_query->set('posts_per_page', -1); | |
$wp_query->set('orderby', 'date'); | |
$wp_query->set('order', 'DESC'); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment