WC_Embed::get_ratings
Prints the markup for the rating stars.
Метод класса: WC_Embed{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$result = WC_Embed::get_ratings();
Список изменений
| С версии 2.4.11 | Введена. |
Код WC_Embed::get_ratings() WC Embed::get ratings WC 10.8.1
<?php
public static function get_ratings() {
// Make sure we're only affecting embedded products.
if ( ! self::is_embedded_product() ) {
return;
}
$_product = wc_get_product( get_the_ID() );
if ( $_product && $_product->get_average_rating() > 0 ) {
?>
<div class="wc-embed-rating">
<?php
printf(
/* translators: %s: average rating */
esc_html__( 'Rated %s out of 5', 'woocommerce' ),
esc_html( $_product->get_average_rating() )
);
?>
</div>
<?php
}
}