WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] php echo the_time('Y')

[Resolved] php echo the_time('Y')

  • This php code should generate the current year were living in right?

    <?php echo the_time('Y');?>

    But it still gives 2012?

    I think it has something to do with the hosting server.. any clue? Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Phil

    @owendevelopment

    Try this:

    <?php echo date("Y")?>

    the_time references the publish time of the post/page and gives inconsistent values when used outside loops. the_date should be used in templates/footers etc.

    I love you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] php echo the_time('Y')’ is closed to new replies.
Skip to toolbar