• Resolved alexblue71

    (@alexblue71)


    Hi,

    I would like to add the date of the post to the related posts list.

    I already have a slightly customized yarpp-template-list.php – file. So I just could add the function there. I tried “get_the_date()”, but that did not work.

    EDIT:
    I just encountered, that get_the_date() IS working, I only made a php-error.

    But now I would like to format the date. How could that be done?

    Tx for help 🙂
    Greets, Alex

    • This topic was modified 2 months ago by alexblue71.
    • This topic was modified 2 months ago by alexblue71.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Michael Nelson

    (@mnelson4)

    Ok thanks for the update @alexblue71.

    The WordPress function get_the_date() defaults to using the date format you set in the WordPress General Settings. So the easiest way to change them is to change the WordPress General Settings’ Date Format by going to the WordPress admin dashboard, under “Settings” menu item click “General”. Then change “Date Format” to the format you like (screenshot).

    If you want to use a different format than what’s set site-wide, provide the format in the call to get_the_date(). Eg get_the_date('F js, y') will echo a date like “January 8th, 2021”. The available formats are documented here: https://www.php.net/manual/en/datetime.format.php

    Does that help?

    Thread Starter alexblue71

    (@alexblue71)

    Thanks a lot, this worked fine for me!!

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.