Function Reference: geodir_get_rating_stars

Summary

HTML for rating stars

Description

This is the main HTML markup that displays rating stars.

Package

GeoDirectory

Parameters

$rating
(float) (required) The post average rating.

Default: None
$post_id
(int) (required) The post ID.

Default: None
$small
(bool) (optional) Display as small ratings? Default: false.

Default: None

Return Values

(string)
  • Rating HTML.

Change Log

Since: 1.0.0

1.6.16 Changes for disable review stars for certain post type.

Filters

‘geodir_get_rating_stars_html’ [Line: 957]

Source File

geodir_get_rating_stars() is located in geodirectory-functions/comments_functions.php [Line: 930]

Source Code

function geodir_get_rating_stars($rating, $post_id, $small = false)
{
    if (!empty($post_id) && geodir_cpt_has_rating_disabled((int)$post_id)) {
        return NULL;
    }
    $a_rating = $rating / 5 * 100;

    if ($small) {
        $r_html = '
'; } else { if (function_exists('geodir_reviewrating_draw_overall_rating')) { // Show rating stars from review rating manager $r_html = geodir_reviewrating_draw_overall_rating($rating); } else { $rating_img = 'rating icon'; /* fix rating star for safari */ $star_width = 23 * 5; if ($star_width > 0) { $attach_style = 'max-width:' . $star_width . 'px'; } else { $attach_style = ''; } $r_html = '
' . $rating_img . $rating_img . $rating_img . $rating_img . $rating_img . '
'; } } return apply_filters('geodir_get_rating_stars_html', $r_html, $rating, 5); }