WC_Embed::the_excerpt()
Create the excerpt for embedded products - we want to add the buy button to it.
Метод класса: WC_Embed{}
Хуков нет.
Возвращает
Строку
.
Использование
$result = WC_Embed::the_excerpt( $excerpt );
- $excerpt(строка) (обязательный)
- Embed short description.
Список изменений
С версии 2.4.11 | Введена. |
Код WC_Embed::the_excerpt() WC Embed::the excerpt WC 8.7.0
public static function the_excerpt( $excerpt ) { global $post; // Get product. $_product = wc_get_product( get_the_ID() ); // Make sure we're only affecting embedded products. if ( self::is_embedded_product() ) { echo '<p><span class="wc-embed-price">' . $_product->get_price_html() . '</span></p>'; // WPCS: XSS ok. if ( ! empty( $post->post_excerpt ) ) { ob_start(); woocommerce_template_single_excerpt(); $excerpt = ob_get_clean(); } // Add the button. $excerpt .= self::product_buttons(); } return $excerpt; }