Function Reference: geodir_no_rating_get_sort_options

Summary

Skip overall rating sort option when rating disabled.

Package

GeoDirectory

Parameters

$options
(array) (required) Sort options array.

Default: None
$post_type
(string) (required) The post type.

Default: None

Return Values

(array)
  • Modified sort options array.

Change Log

Since: 1.0.0

1.6.16 Changes for disable review stars for certain post type.

Source File

geodir_no_rating_get_sort_options() is located in geodirectory_hooks_actions.php [Line: 2673]

Source Code

function geodir_no_rating_get_sort_options($options, $post_type = '') {
    if (!empty($post_type) && geodir_cpt_has_rating_disabled($post_type)) {
        $new_options = array();
        
        if (!empty($options)) {
            foreach ($options as $option) {
                if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
                    continue;
                }
                $new_options[] = $option;
            }

            $options = $new_options;
        }
    }

    return $options;
}