rep__agency_rating_details_html( $post_id )

This function is responsible for generating HTML markup that displays agency rating details, including the average rating and the total number of reviews.

Namespace

REP_Malcolm

Parameters

$post_id

array

Agency post id

Return

string

Agency rating details.

Source

File: \includes\rep-helper-functions.php

function rep__agency_rating_details_html( $post_id ){

    ob_start();
    
    $reviews = lp__get_field_value( 'rea_total_reviews', $post_id );
    $rating = lp__get_field_value( 'rea_avg_rating', $post_id );

    if( $rating || $reviews ) : ?>

        <div class="rep-rating-details rep-agency-rating-details"><?php

            if( $rating ) :

                ?><span class="rep-rating rep-agency-rating"><?= $rating; ?></span> <?php

            endif;
                    
            if( $reviews ): 

                $url = lp__get_field_value( 'rea_agency_profile_url', $post_id );
                $s = (int)$reviews > 1 ? "s" : "";
                $reviews = "{$reviews} review{$s}";

                ?><span class="rep-review-count rep-agency-review-count"><?php 
                    if( $url ) :
                        echo lp__link_html( $url, $reviews, ["target"=>"_blank", "rel"=>"noopener"] ); 
                    else:
                        echo $reviews;
                    endif;
                ?></span><?php 

            endif; ?>

        </div><?php
    
    endif;

    return ob_get_clean();

}