Customizing Suggested phrases layout

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 Ernest Marcinko 8 years, 8 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #6747
    Orel Elimelech
    Orel Elimelech

    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?


    Ernest Marcinko
    Ernest Marcinko


    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.

    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.