Skip to content

Commit

Permalink
resolves #363
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesros161 committed Jul 19, 2022
1 parent 3aa8604 commit d2c7ef2
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,16 @@ public function posts_where( $where ) {
* @return WP_Query $query The WP_Query instance.
*/
public function set_main_query( WP_Query $query ) {
// Do not modify query if this is a product. Woocommerce uses its own custom ordering.
if ( 'product' === $query->get( 'post_type' ) ) {
return $query;
}

if ( ( $query->is_archive() || $query->is_home() ) && $query->is_main_query() ) {
$query->set( 'orderby', 'date modified title' );
$query->set( 'order', 'desc' );
}

return $query;
}

Expand Down

0 comments on commit d2c7ef2

Please sign in to comment.