Function Reference: geodir_posts_join

Summary

Listing tables join filter.

Global Values

$wpdb
(object) (required) WordPress Database object.

Default: None
$table_prefix
(string) (required) WordPress Database Table prefix.

Default: None
$plugin_prefix
(string) (required) Geodirectory plugin table prefix.

Default: None
$table
(string) (required) Listing table name.

Default: None

Package

GeoDirectory

Return Values

(string)
  • Modified join query.

Change Log

Since: 1.0.0

Source File

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

Source Code

function geodir_posts_join($join)
{
    global $wpdb, $geodir_post_type, $table, $table_prefix, $plugin_prefix;

    ########### WPML ###########

    if ( geodir_wpml_is_post_type_translated( $geodir_post_type ) ) {
        global $sitepress;
        $lang_code = ICL_LANGUAGE_CODE;
        $default_lang_code = $sitepress->get_default_language();
        if ($lang_code) {
            $join .= "JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID";
        }

    }
    ########### WPML ###########

    $join .= " INNER JOIN " . $table . " ON (" . $table . ".post_id = $wpdb->posts.ID)  ";
    //===old code start
    //$join .= " INNER JOIN ".POST_LOCATION_TABLE." ON (".$table.".post_location_id = ".POST_LOCATION_TABLE.".location_id)  " ;//===old code end

    return $join;
}