Support » Fixing WordPress » display post date

  • hi,
    I would like on my main page to display post date and followed by posts of that date. Something like in those deals sites with date and follow by deals of that day.

    thanks

    7/12/12 <= how to I insert this in the template?
    1) post 1
    2) post 2
    3) post 3

    7/11/12
    1) post 1
    2) post 2

Viewing 1 replies (of 1 total)
  • You need to keep track of the current date being displayed and show a new date when one is found. The WP function the_date() can be used to do what you want. Your code would be something like this:

    while (have_posts()) : the_post();
       the_date('F j,Y','<h2>','</h2>');
       // rest of Loop
    endwhile;

    This would show the date in <h2> tags each time a new date is found.

Viewing 1 replies (of 1 total)
  • The topic ‘display post date’ is closed to new replies.