the image is worth a thousand words. take a look at it.
you know how craigslist has posts organized by date ..ex
Tue 3
post links for tuesday
Wed 4
post links for wed
Thurs 5
post links for thur
I know wordpress posts are organized by date by default.
take a look at this
any ideas? btw if this did not make sense let me know. tx
You may notice that I did more or less exactly this for Matt’s site: http://ma.tt. Every set of posts is grouped by the day. The basic principle is to keep track of your day in the loop, then print the date and related stuff only when it changes.
Take a basic Loop:
This just prints the title and content (without any formatting or anything) for everything in the current Loop. Now, you want it to pop out a new date every time the date changes. So you need to keep track of when it changes. Like so:
What this does is to store the date that you’re wanting to output into a variable. Each pass through the loop, it gets it again and checks to see if it has changed. If it has not changed, then nothing happens. If it has changed, then it sets the variable with the new date string, outputs it, then moves on.
Obviously this is just an example. The specific details depend on how your existing loop works and how you want to output the information.
While it’s true that the_date() does this by default, sometimes it’s easier to do it yourself in this manner, for formatting reasons.
As @goldenapples noted, if your template uses the the_date(); template tag, it’ll do this all on its own, as the default. I remember being confused the first time I used WordPress and I couldn’t figure out how to get it to stop doing this.
Have you tested already and this isn’t the result you’re getting? It may simply be a matter of changing the tags your template is using.
Cheers.
UPDATE
updated according to notes in comment
here you go,
put this instead of your loop
get_the_date() or get_the_time() calls are overcomplicating the results. Simply use the_date(), which will only print the date once per day of posts by default.
See The Codex article on this subject:
http://codex.wordpress.org/Function_Reference/the_date