Answer the question
In order to leave comments, you need to log in
How to insert translation string into php code?
How between span tag
<?php echo apply_filters( 'woocommerce_sale_flash', '<span class="onsale">' . esc_html__( 'Sale!', 'woocommerce' ) . '</span>', $post, $product ); ?>
'Скидка');
pll_e(
Answer the question
In order to leave comments, you need to log in
<?php echo apply_filters( 'woocommerce_sale_flash', '<span class="onsale">' . pll__( 'Скидка' ) . '</span>', $post, $product ); ?
It is advisable to check before the output that polylang is activated, otherwise you will catch a fatal error
if ( is_plugin_active( 'polylang/polylang.php' ) ) {
$sale = pll__( 'Скидка' );
} else {
$sale = esc_html__( 'Sale!', 'woocommerce' );
}
echo apply_filters( 'woocommerce_sale_flash', '<span class="onsale">' . $sale . '</span>', $post, $product );
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question