Support » Fixing WordPress » // Hack. Set $post so that the_date() works

  • Whhen should the code below be used?

    `<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>’

Viewing 2 replies - 1 through 2 (of 2 total)
  • I have seen this used before the Loop when wanting to display the date of the first post. So, it is placed before the ‘if (have_posts())’ test.

    If you are not displaying a post date before the Loop, then this is not needed.

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘// Hack. Set $post so that the_date() works’ is closed to new replies.