WC_Admin_List_Table_Products::add_sample_product_badge
Add a sample product badge to the product list table.
Метод класса: WC_Admin_List_Table_Products{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$WC_Admin_List_Table_Products = new WC_Admin_List_Table_Products(); $WC_Admin_List_Table_Products->add_sample_product_badge( $column_name, $post_id );
- $column_name(строка) (обязательный)
- Column name.
- $post_id(int) (обязательный)
- Post ID.
Список изменений
| С версии 8.8.0 | Введена. |
Код WC_Admin_List_Table_Products::add_sample_product_badge() WC Admin List Table Products::add sample product badge WC 10.3.4
public function add_sample_product_badge( $column_name, $post_id ) {
$is_sample_product = 'product' === get_post_type( $post_id ) && get_post_meta( $post_id, '_headstart_post', true );
if ( $is_sample_product && 'name' === $column_name ) {
echo '<span class="sample-product-badge" style="margin-right: 6px;border-radius: 4px; background: #F6F7F7; padding: 4px; color: #3C434A;font-size: 12px;font-style: normal;font-weight: 400;line-height: 16px; height: 24px;">' . esc_html__( 'Sample', 'woocommerce' ) . '</span>';
}
}