Function Reference: geodir_get_sort_options
Summary
Returns sort options of a post type.
Global Values
- $wpdb
- (object) (required) WordPress Database object.
- Default: None
Package
GeoDirectory
Parameters
- $post_type
- (string) (required) The post type.
- Default: None
Return Values
- (bool|mixed|void)
- Returns sort results, when the post type is valid.
- Otherwise returns false.
Change Log
Since: 1.0.0
Filters
‘geodir_get_sort_options’ [Line: 595]
Source File
geodir_get_sort_options() is located in geodirectory-functions/custom_functions.php [Line: 572]
Source Code
function geodir_get_sort_options( $post_type ) { global $wpdb; if ( $post_type != '' ) { $all_postypes = geodir_get_posttypes(); if ( ! in_array( $post_type, $all_postypes ) ) { return false; } $sort_field_info = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type=%s AND is_active=%d AND (sort_asc=1 || sort_desc=1 || field_type='random') AND field_type != 'address' ORDER BY sort_order ASC", array( $post_type, 1 ) ) ); /** * Filter post sort options. * * @since 1.0.0 * * @param array $sort_field_info Unfiltered sort field array. * @param string $post_type Post type. */ return apply_filters( 'geodir_get_sort_options', $sort_field_info, $post_type ); } }