Blog Page: enter image description hereSingle Post:

enter image description here

I'd like to greet everyone a Happy New Year and Happy Holidays. I have a request on how to put a label "New" beside the title post on my recent post and my single recent post(red Mark in the photo). I keep on finding for answers on the internet for days and I couldn't find one. I hope you guys give an idea, demo or answers on this particular wordpress subject this would give me a big help and I hope I didn't bother anyone on celebrating your holiday. Thank you.

  • This is something you'll probably want to add to your theme, both the archive page (for the top one?) and the single post page for the bottom one. Whatever your logic for 'new' you can then output the 'new' text / icon next to the date. Can you find the relevant bits in your theme? If it's a third-party theme you might want to make a child theme to do the actual extending so that you don't lose your changes when the source theme updates.
    – Rup
    Commented Dec 29, 2019 at 12:34

1 Answer 1


This should get you started. It checks if the post was posted less than a day ago, and if it was, it will display a label that says new, which you can style.

<?php if(get_the_date('Y-m-d-H-i-s') > date("Y-m-d-H-i-s",strtotime("-1 day"))) { ?>
<span class="new-label">New</span>
<?php } ?>

You need to add this to your theme, in the file that displays posts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.