- This topic has 10 replies, 3 voices, and was last updated 9 years, 9 months ago by
Eyal Fitoussi.
-
AuthorPosts
-
September 6, 2012 at 2:24 pm #34567
tomgrow
MemberHello,
I am trying to make a keyword search
How do I add New Text field which can search data from my word press titles & description content
I have tried creating a text box, for example my Tittle is “My name is” when I give any of these 3 words in search for example ” name” then it does not show my listing but when I give compete keyword ” my name is” then it does
I get the following on search when I give any word like “name”
SELECT SQL_CALC_FOUND_ROWS wposts.post_id, wposts.lat, wposts.long, wposts.address, wposts.post_title, wposts.phone, wposts.fax, wposts.email, wposts.website FROM wp_places_locator wposts WHERE (1 = 1) AND wposts.post_title LIKE ‘abcd’ AND wposts.post_id IN (2417,2414,2413,2343,2061,2063,2059,2053,2050,2037,2035,1978,1982,1983,1984,24,20) ORDER BY wposts.post_title LIMIT 0,10
Please help
September 7, 2012 at 7:52 am #34577Eyal Fitoussi
MemberHi Tomgrow,
I am already planing to add a text field for a post title lookup ( not for description). I am not sure how to exactly do it right now but it seems that you are in the right direction. I am away in my country right now for 3 weeks so I don’t get to work on the plugin. However , if I’ll have a free night to look into it I might get it for you. But I can’t promise. But when I will be back I will to release an update of few bug fix so I’ll try to add this function already by then.September 7, 2012 at 12:31 pm #34576tomgrow
MemberHi,
Thank you for your reply.
I wish if you get a free night soon so my problem gets resolved
Thanks
September 8, 2012 at 7:24 pm #34575jacqui
MemberI need this also…
September 9, 2012 at 8:15 am #34574Eyal Fitoussi
Memberi did not forget you jacqui 🙂
i will probably add this feature in the next update when i’ll be back in two weeks or so. i just can’t find enough free time here to do it.September 9, 2012 at 10:13 am #34573tomgrow
MemberHi,
I have done it
Thanks
September 9, 2012 at 11:01 am #34572Eyal Fitoussi
MemberTomgrow, this is great. Could you post a link so I could see ? And maybe post the solution here for Jacqui and other users that are looking for it?
September 10, 2012 at 7:21 am #34571tomgrow
MemberHi,
This is how I did
First added a text box field in file (/wp-content/plugins/wordpress-places-locator/get-places.php)
<input type=”text” name=”wppl_searchk” class=”wppl-address” size=”35″ value=”‘. $_GET[‘wppl_searchk’] . ‘” size=”35″‘;echo($address_title ==1) ? ‘placeholder=”Enter a keyword . .”‘ : “”; echo ‘ />Added above text filed value in search query in file ((/wp-content/plugins/wordpress-places-locator/get-places.php)
First check the above textbox filed value is blank or not
$searchk = $_GET[‘wppl_searchk’];
if ($searchk != “”)
{
$searchkk = “AND (((wposts.post_title LIKE ‘%$searchk%’) OR (wpostsw.post_content LIKE ‘%$searchk%’)))”;
};
After that
$sql =”SELECT SQL_CALC_FOUND_ROWS wposts.post_id, wposts.lat, wposts.long, wposts.address, wposts.post_title, wposts.phone, wposts.fax, wposts.email, wposts.website, wpostsw.post_content, wpostsw.ID {$calculate}
FROM ” . $wpdb->prefix . “places_locator as wposts INNER JOIN ” . $wpdb->prefix . “posts as wpostsw ON wposts.post_id = wpostsw.ID
WHERE
(1 = 1)
{$searchkk} AND wposts.post_id IN (” . implode( ‘,’ , $query->posts) . “)
{$having} ORDER BY {$order_by} LIMIT ” . $from_page . “,” . $per_page ;
After that you need to comment the below line.
//$sql = $wpdb->prepare($sql,$values);
It works for me
let me know if I did it correctly
Thanks
September 17, 2012 at 4:41 pm #34570Eyal Fitoussi
MemberHi Tomgrow,
i just saw your replay, Thank you.
it seems to be the way to do it but i will work on it after next week when i be back home and i will let you know. I will probably add it to the plugin together with some bug fix.Thank you
October 5, 2012 at 12:25 pm #34569tomgrow
MemberHello,
Are you back home?
Any update please
Thanks
October 5, 2012 at 3:59 pm #34568Eyal Fitoussi
MemberHi tomgrow,
yes , I came back last week. I have been workin on bugs since then and trying to get it done. I have to get that ready together with othe premium version. Honestly, I did forget about the text box but now when you reminded me I’ll see if I can push it to this update coming.
is your solution works? Have you had any issues with that?
-
AuthorPosts
You must be logged in to reply to this topic.