WordPress.org

Ready to get started?Download WordPress

Forums

How do I add post/publish time in my blog posts? (5 posts)

  1. Anonymous
    Unregistered
    Posted 6 years ago #

    Hi,

    I am currently using the Hong Kong night theme for WordPress and I was just wondering if there is a way I could also show post/publish time in my posts everytime I post something.

    I understand this might be done in the php files, most probably single_post.php, but I'm not very well-versed in scripting or php, so if anyone could point me to the right direction, that would be great. Thanks a lot :)

  2. Keilya
    Member
    Posted 6 years ago #

    You just need to add <?php the_time() ?> into your theme files. I'm not sure which file it may be, but that's the snippet to display the time. (:

  3. Anonymous
    Unregistered
    Posted 6 years ago #

    Hi Fantasycrusader,

    Thanks, I saw that actually in the single_post.php..Something like this:

    <div class="post-date"><span><?php the_time('d') ?></span><?php the_time('M') ?></div>

    I think the d would be date and M would be month, wouldn't it? I would like to add the time as in hour and minute. Will that be possible? Maybe <?php the_time('h') ?> for hour and <?php the_time('m') ?> for minute? I'm just guessing...

  4. Anonymous
    Unregistered
    Posted 6 years ago #

    Oh wow, I found the help file for the date/time command. I think we can mark this resolved. Thank you.

    Help page: http://codex.wordpress.org/Template_Tags/the_time

  5. Anonymous
    Unregistered
    Posted 6 years ago #

    Sorry I cant STAND when people dont answer the actual question asked but give you links to 50 different things

    Here is "THE answer" for the next visitor that happens on this thread and gets confused.

    go to THIS dir whereever it is

    wp-content\themes\default
    (assuming default theme which if you are new like I am.. thats what theme you are using)

    the file in there marked index.php open it in a text editor.

    find

    <?php the_time('F jS, Y') ?>

    before it put this

    Time posted: <?php the_time('g:i a'); ?>
    make sure there is a SPACE between the > and the < or it will be jammed together.

    if you want to put the time AFTER the date.. well then with a space.. put

    Time posted: <?php the_time('g:i a'); ?>

    behind

    <?php the_time('F jS, Y') ?>

    so.. there you go.. if you want to know more.. check those links out.. but it is a simple problem with a simple solution.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.