Last active
December 19, 2019 11:34
-
-
Save bulentsakarya/c13a5ef654ce0883e9b8d07ac447f64d to your computer and use it in GitHub Desktop.
woocommerce new badge for new products
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'woocommerce_before_shop_loop_item_title', '_new_badge_shop_page', 3 ); | |
function _new_badge_shop_page() { | |
global $product; | |
$gun = 30; // Etiket son 30 günde eklenen ürünlere eklenecek | |
$eklenme_tarihi = strtotime( $product->get_date_created() ); // Ürünün eklenme tarihi | |
if ( ( time() - ( 60 * 60 * 24 * $gun ) ) < $eklenme_tarihi ) { | |
echo '<span class="yeni onsale">' . esc_html__( 'Yeni!', 'wootemasi' ) . '</span>'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment