Function Reference: geodir_post_location_countries
Summary
Get location countries.
Global Values
- $wpdb
- (object) (required) WordPress Database object.
- Default: None
Package
GeoDirectory_Location_Manager
Parameters
- $list
- (bool) (required) Return as list? Default: false.
- Default: None
Return Values
- (array|mixed)
Change Log
Since: 1.0.0
Source File
geodir_post_location_countries() is located in geodir_location_manager/geodir_location_functions.php [Line: 2840]
Source Code
function geodir_post_location_countries( $list = false ) { global $wpdb; $sql = "SELECT country, country_slug, count(location_id) AS total FROM " . POST_LOCATION_TABLE . " WHERE country_slug != '' && country != '' GROUP BY country_slug ORDER BY country ASC"; $rows = $wpdb->get_results( $sql ); $items = array(); if ( $list && !empty( $rows ) ) { foreach( $rows as $row ) { $items[$row->country_slug] = get_actual_location_name( 'country', $row->country_slug, true ); } asort( $items ); $rows = $items; } return $rows; }