Tuesday, October 8, 2013

tampilkan random search term stt2 terbaru

tambahkan fungsi untuk tampilkan random search term stt2 terbaru :
function stt_rand_terms($count=10){
    global $wpdb;
    $start_time = round(microtime(),3);
    $options = get_option('pk_stt2_settings');
    $sql = "SELECT `meta_value`,`meta_count`,`post_id` FROM `".$wpdb->prefix."stt2_meta` ORDER BY RAND() LIMIT ".$count.";";
    $searchterms = $wpdb->get_results($sql);
    if(!empty($searchterms)) {
          $result = pk_print_searchterms($searchterms,$options);
      return $result;
    } else {
        return false;
    }
}

lalu pasang di widget :
<?php if(function_exists('stt_rand_terms')) echo stt_rand_terms(10) ;?>

No comments:

Post a Comment