Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function request( $query ) {
- if ( ! is_admin() ) {
- $wp_query = new WP_Query();
- $wp_query->parse_query( $query );
- $apply_filters = false;
- if ( $wp_query->is_home() || isset( $wp_query->tax_query ) || $wp_query->is_archive() ) {
- if ( $wp_query->is_home() ) {
- global $thecartpress;
- $activate_frontpage = $thecartpress->get_setting( 'activate_frontpage' );
- if ( ! $activate_frontpage ) return $query;
- $apply_filters = true;
- $taxonomy_term = $thecartpress->get_setting( 'taxonomy_term', '' );
- if ( strlen( $taxonomy_term ) > 0 ) {
- $taxonomy_term = explode( ':', $taxonomy_term );
- $query[$taxonomy_term[0]] = $taxonomy_term[1];
- }
- }
- if ( isset( $wp_query->tax_query ) ) {
- foreach ( $wp_query->tax_query->queries as $tax_query ) { //@See Query.php: 1530
- if ( tcp_is_saleable_taxonomy( $tax_query['taxonomy'] ) ) {
- $apply_filters = true;
- break;
- }
- }
- }
- if ( $wp_query->is_archive() && isset( $wp_query->query_vars['post_type'] ) ) { //&& tcp_is_saleable_post_type( $wp_query->query_vars['post_type'] ) ) {
- $apply_filters = true;
- }
- }
- if ( $apply_filters || isset( $wp_query->query_vars['post_type'] ) && tcp_is_saleable_post_type( $wp_query->query_vars['post_type'] ) ) {
- $query['meta_query'][] = array(
- 'key' => 'tcp_is_visible',
- 'value' => 1,
- 'compare' => '='
- );
- }
- $filter = new TCPFilterNavigation();
- if ( $apply_filters ) {
- //if ( isset( $wp_query->query_vars['post_type'] ) && tcp_is_saleable_post_type( $wp_query->query_vars['post_type'] ) ) {
- $query['posts_per_page'] = (int)$this->get_setting( 'products_per_page', 10 );
- if ( $filter->is_filter_by_layered() ) {
- $layered = $filter->get_layered();
- foreach( $layered as $tax => $layers ) {
- $query[$tax] = '';
- foreach( $layers as $layer ) {
- $query[$tax] .= $layer . ',';
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement