Great customer support
- Our team support is ready to provide you with best on-time support you need. we are ready to handle any situation regarding websites and servers
- Free live consultant will be ready to help u out whenever possible
Great customer support
Hi!
I am currently trying your plugin Ajaxy Search for one of my sites.
I am in the need of tweaking the plugin a bit to allow including meta_values in the search. (not as a separate post type)
When someone search for “alive” i want them to find post with “alive” in the post_title or two meta values for this post.
I have made some adjustments in the file sf.php making it work with post_title and a meta_value field se below,
$results = $wpdb->get_results( $wpdb->prepare(“select $wpdb->posts.ID from $wpdb->posts INNER JOIN $wpdb->postmeta m1 ON ($wpdb->posts.ID = m1.post_id) where ((post_title like ‘%%%s%%’) “.($checking == 1 ? “or (meta_key = ‘my_meta_value’ and meta_value like ‘%%%s%%’))”:”)”).” AND post_status=’publish’ and post_type=’”.$post_type.”‘ $excludes $order_results GROUP BY $wpdb->posts.ID limit 0,”.$setting->limit, ($checking == 1 ? array($name, $name):$name)));
But when i add another meta_value to the code or try to alter AND OR in the SQL everything breaks. I have come to the conclusion that when using ‘%%%s%%’ more than two times in the SQL it breaks.
See here what i am attempting to do,
$results = $wpdb->get_results( $wpdb->prepare(“select $wpdb->posts.ID from $wpdb->posts INNER JOIN $wpdb->postmeta m1 ON ($wpdb->posts.ID = m1.post_id) where ((post_title like ‘%%%s%%’) or (meta_key = ‘my_meta_value’ and meta_value like ‘%%%s%%’) “.($checking == 1 ? “or (meta_key = ‘my_meta_value’ and meta_value like ‘%%%s%%’))”:”)”).” AND post_status=’publish’ and post_type=’”.$post_type.”‘ $excludes $order_results GROUP BY $wpdb->posts.ID limit 0,”.$setting->limit, ($checking == 1 ? array($name, $name):$name)));
I would like some guidance on how to add two meta_values in the search and possibly as a last add-on the ability to also search post_content if that is checked in admin (i have now removed it and replaced with my quirky code).
Let me know if this is possible or/and if you can help us out with this.
I am willing to pay you for your services, you can use up to 30$ of consultant fee so you can test code before getting back to me.
Payment preferable using paypal.
Thanks in advance
/Tony