• 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 ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • Keilya

    (@fantasycrusader)

    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. (:

    Thread Starter 749223

    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…

    Thread Starter 749223

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

    Help page: https://codex.www.ads-software.com/Template_Tags/the_time

    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.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How do I add post/publish time in my blog posts?’ is closed to new replies.