On posts I use this:

Time created

<?php the_time('Y-m-d'); ?>

Edited (updated)

<?php the_modified_time('Y-m-d'); ?>

It works fine on posts, but on page template it displays just created time, modified (update) time is blank.

Question 1: How to show modified time on pages too?

Question 2: Also I need to display both times on category, tag and author pages. Using codes above I get those times, but from last post on current page, and I would like to get times from first post on current browsing page. I have default post order (latest first), so I need latest post's times, which is first post on current page, and like I said I get times of last post on current page.

How to get created / modified time of first post on current browsing page on category, tags, archive?


I need to display created and modified time outside of the loop.

  • both functions have to be used within the loop - what is your full code, and where are you using the functions? – Michael Sep 26 '14 at 19:22
  • Yes, I used them outside of the loop. How to get times outside the loop? – Advanced SEO Sep 27 '14 at 11:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.