Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Customizing Suggested phrases layout
This topic contains 1 reply, has 2 voices, and was last updated by Ernest Marcinko 8 years ago.
- AuthorPosts
- November 24, 2015 at 6:58 pm #6747
Hi,
is there any structured way to add popular search terms or popular tags into the phrases suggestions div (try this)?If not- can you supply me with a hook to return Top 20 Search Phrases? maybe a hook/filter to enter this data into that div?
Thanks!
-
This topic was modified 8 years ago by
Orel Elimelech.
November 24, 2015 at 7:35 pm #6755Hi!
There is no option for that, but here is a filter I quickly put together:
add_filter("asp_results", "asp_top_keywords"); function asp_top_keywords( $results, $id ) { $count = 20; // How many keywords? if ( !isset($results['nores']) ) return $results; global $wpdb; $keywords = array(); $_keywords = $wpdb->get_results(" SELECT keyword FROM ".$wpdb->base_prefix."ajaxsearchpro_statistics ORDER BY num desc LIMIT " . $count, ARRAY_A); foreach($_keywords as $k=>$v) { $keywords[] = $v['keyword']; } $results['keywords'] = $keywords; return $results; }
Add this to the functions.php file in your active themes folder. Before using this, don’t forget to turn on the search statistics on the Search Statistics submenu. It will not work without it.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
-
This topic was modified 8 years ago by
- AuthorPosts
You must be logged in to reply to this topic.