$post_date = get_the_date('Y-m-d', $product->get_id()); $post_date_time = strtotime($post_date); $current_date_time = strtotime(current_time('Y-m-d')); $date_diff = ($current_date_time - $post_date_time) / (60 60 24); if ($date_diff <= 30): ?> <span class="new-label">New</span> <?php endif; ?>
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter