Function Reference: geodir_filter_widget_where

Summary

advanced where filter for popular post view widget.

Global Values

$wp_query
(object) (required) WordPress Query object.

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

Default: None

Package

GeoDirectory

Parameters

$where
(string) (required) The where query string.

Default: None

Return Values

(string)
  • Modified where query string.

Change Log

Since: 1.0.0

Source File

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

Source Code

function geodir_filter_widget_where($where)
{
    global $wp_query, $table;
    if (!empty($wp_query->query['show_featured_only'])) {
        $where .= " AND " . $table . ".is_featured = '1'";
    }
    if (!empty($wp_query->query['show_special_only'])) {
        $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )";
    }
    if (!empty($wp_query->query['with_pics_only'])) {
        $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL GROUP BY " . $table . ".post_id";
    }
    if (!empty($wp_query->query['with_videos_only'])) {
        $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )";
    }
    return $where;
}