tr_posted_on

{tr_posted_on($post_id, $with_last_updated)}

Prints the publish date, and optionally the date when the post was modified as well

Arguments:

  1. $post_id. If we are using this function inside our custom loops. We need to pass the ID of the post. Optional, Type: INT or false, Default: false.
  2. $with_last_updated. Whether we should also print the last updated date. Optional, Type: boolean, Default: false.

The format of the date that we use is the one that we can set under wp-admin/settings/general/Date Format

In a scenario where we are using this function from inside a custom get_posts loop, we need to provideĀ  $post_id as the first argument.

When used from inside the main WP loop, we don’t need to provide it.

Join Our Newsletter

To get updates about Theme Redone