This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Customizing Suggested phrases layout

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Customizing Suggested phrases layout

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

    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!

    #6755
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi!

    There is no option for that, but here is a filter I quickly put together:

    [php]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;

    }[/php]

    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.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.