Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] How to add time in blog post?

  • Profile photo of bg
    bg
    Member

    @sobuddy

    Hi, I’m using child theme for the bp-default theme, but the default theme only shows the date in the blog post not the time. And I would like to add the time to it too how do I do it? I thank you in advance!

    My website is, http://buddygalaxy.com.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Profile photo of Tammie Lister
    Tammie
    Moderator

    @karmatosed

    The default theme uses https://codex.wordpress.org/Function_Reference/get_the_date so that would be a good spot for starting to modify that. It uses your set date and time format in WordPress under settings so you can modify that there and it will reflect on the theme.

    “Default: the date_format option (‘Date Format’ on Settings > General panel)”

    Profile photo of Roger Coathup
    Roger Coathup
    Participant

    @rogercoathup

    or just pass a PHP date format to the function call in your blog post template, if you don’t want date format changing across the site.

    Profile photo of bg
    bg
    Member

    @sobuddy

    Thanks to you both for the prompt responses! But, I can’t seem to find the exact file to modify the time or add the time code into it. I have also changed the time setting under General, but still only the date that shows, not the time?!

    Profile photo of Roger Coathup
    Roger Coathup
    Participant

    @rogercoathup

    in bp-default single blog posts are displayed using single.php, and archive.php for the archive view

    Profile photo of bg
    bg
    Member

    @sobuddy

    Thank you so much Roger Coathup! I could now make the time to show, although people have to click on the blog’s title first to read the rest of the blog before they could see the time. Anyway, it works! Thank you so much again. Take care!

    Profile photo of Roger Coathup
    Roger Coathup
    Participant

    @rogercoathup

    thanks for the feedback — glad you got it working

    Profile photo of @mercime
    @mercime
    Keymaster

    @mercime

    @sobuddy you just add the WP template tag to show the time https://codex.wordpress.org/Template_Tags/the_time e.g. “

    Profile photo of bg
    bg
    Member

    @sobuddy

    Thanks @mercime for your suggestion, but in which file should I add the time code because I don’t want to add it in the single.php file since it will only show up in single post. I want the time to show on the main blog page, so in which file should I modify? Beforehand Thanks!

    Profile photo of bg
    bg
    Member

    @sobuddy

    I have sorted it out already. Anyway Thanks!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Resolved] How to add time in blog post?’ is closed to new replies.