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

Sort in WP_Query(), not filter? Is it possible?

If you want to sort the posts by the meta post_views_count, and still include posts that do not have that meta, you can use meta_query like so: ‘meta_query’ => array( ‘relation’ => ‘OR’, // make sure it’s OR // Include posts that have the meta. array( ‘key’ => ‘post_views_count’, ‘compare’ => ‘EXISTS’, ), // Include … Read more

Dynamically Override Fancy Title – Part II

I finally got it. The final version of the function is: <?php // ACCOMODATION TITLE add_filter (‘presscore_get_page_title’,’netbooking_presscore_get_page_title’,10,1); function netbooking_presscore_get_page_title ( $title ) { if( is_page( ‘1057’ ) ){ $GLOBALS[“content”] = $content; // This reads input considering a default value in case of error $INPUT = function($param, $default, $prefix = true){ $key = $prefix ? ‘netbooking_structure_’.$param … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)