Support » How-To and Troubleshooting » Display post date and time

Display post date and time

  • For each title of my blog post, I want to have it display PHP. The PHP shows the time and date that the entry was posted. How can I go about doing that? I have the PHP coding, I just need to know how I can make WordPress publish it.

Viewing 15 replies - 1 through 15 (of 15 total)
  • You’re going to have to give a little more information about your request. For example: You want it to display PHP. PHP? Do you mean PHP code of your own devising, or WordPress “template tags”?

    Post time and date are built-in template tags or functions you an use. Check out the documentation on their use:


    This is the string of PHP I want it to display in the header of my page:

    <?php echo date(“F j, Y | g:i a”); ?>

    Look over the links provided above for the_date() and the_time(), which are WordPress functions specific to date/time on posts.

    Well, you can’t just use that code because it won’t reflect the date of the post as it is stored in the database.

    OK. What I meant to say by the way was that I want the time and date displayed for each of the titles, I don’t think I’m gonna have any specific titles for each post.

    What are the titles linked to then?

    This is what I want to do:

    I had my header defined in the CSS. I want the title, which will be the date and time, that I put in WordPress to publish to come out so that the CSS recognizes it and makes it look like the rest of the headers on my site. The setup I want for it is:

    date | time


    And again, what does title, date | time, or whatever relate to? If it’s just the current date and/or time, then your code should work fine, but if it’s for a post, then you need to use the template tags mentioned above, since they’ll display it for the post.

    So I can put normal PHP coding as my title and everything should work out, right?

    It appears we’re crossing wire here:

    Your “normal PHP coding” will work, but it won’t reflect anything related to the post, i.e. when it was actually published. Hence the reason for the template tags, which are in a sense *normal* PHP, but functions specific to WordPress.

    OK what I want to do is show the time and date that the entry was posted. How can I do that?

    Visit the direct links that Kaf provided for you above and that will explain what you need to do.



    I am a new wordpress user, and for now am using the default WordPress theme, because it works with the Hebrew date blugin I’m using. However, the time and author are not being shown on my posts. I looked at the main template for the theme, and it looks like the template tags are there, within <small> </small> tags. What do I do next in order to get that information displayed, so that the date displays, and then “posted by … at …”? Thanks.

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Display post date and time’ is closed to new replies.