Two queries on the same page with pagination

Please use below code hope it’s work for you <div class=”row list-group”> <?php function query_group_by_filter($groupby){ global $wpdb; return $wpdb->postmeta . ‘.meta_value ‘; } global $paged, $wp_query, $wp; $args = wp_parse_args($wp->matched_query); if ( !empty ( $args[‘paged’] ) && 0 == $paged ) { $wp_query->set(‘paged’, $args[‘paged’]); $paged = $args[‘paged’]; } $temp = $wp_query; $wp_query= null; add_filter(‘posts_groupby’, ‘query_group_by_filter’); … Read more

Filter wp_query to search post title in function

If you want to do it via a single WP_Query call, then you can use the posts_clauses filter hook. And the trick is, don’t set the part_number and product_variations_$_part_number meta queries via the meta_query arg, but use the above hook instead, i.e. manually build the SQL clauses. Working Example Note: In your led_search_function() code, the … Read more

Access to Instance Variables from WP_Query

$query = new WP_Query( $args ); if ( $query->have_posts( $query->have_posts()) ) : while( $query->have_posts()) : $query->the_post(); global $post; switch ( $query->current_post ) { case 0 : // first post object is in var $post; echo ‘The first post title is ‘ . $post->post_title; break; case 1 : // because we are insed the loop we … Read more

Search – Ajax – Alter Query Parameters with Pagination

I think this is what you want. base is set via home_url(), format is page/%#%/, search query arg is added via add_args if it exists: $args = array( ‘base’ => home_url( ‘/%_%’ ), ‘format’ => ‘page/%#%/’, ‘current’ => max( 1, get_query_var(‘paged’) ), ‘total’ => $temp->max_num_pages, ); if( isset($_GET[‘s’]) ){ $args[‘add_args’] = array( ‘s’ => $_GET[‘s’] … Read more