Last active
February 21, 2018 00:02
-
-
Save djrmom/2c1bd0ca36a8732e61337f090001f532 to your computer and use it in GitHub Desktop.
facetwp check category listing query for listify
This file contains hidden or 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 | |
// check for job_listings archive and don't use the query unless it is using menu_order | |
add_filter( 'facetwp_is_main_query', function( $is_main_query, $query ) { | |
if ( isset( $query->query_vars['post_type'] ) && 'job_listing' == $query->query_vars['post_type'] | |
&& ( ! isset( $query->query_vars['taxonomy'] ) || '' == $query->query_vars['taxonomy'] ) ) { | |
if ( isset( $query->query_vars['order_by']['menu_order'] ) ) { | |
return true; | |
} else { | |
return false; | |
} | |
} | |
if ( is_tax('job_listing_category' ) && 'job_listing' != $query->get('post_type') ) { | |
return false; | |
} | |
return $is_main_query; | |
}, 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment