Function Reference: geodir_related_posts_fields

Summary

This function has not been documented yet.

Source File

geodir_related_posts_fields() is located in geodirectory-functions/listing_filters.php [Line: 1016]

Source Code

function geodir_related_posts_fields($fields) {
    global $wp_query, $wpdb, $table, $post;

    $fields .= ", " . $table . ".* ";

    $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1'));

    $mylat = $post->post_latitude;
    $mylon = $post->post_longitude;

    $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance ";
    return $fields;
}