Opened 14 years ago
Closed 11 years ago
#13771 closed enhancement (fixed)
get_the_date() to accept optional $post argument
Reported by: | bigdawggi | Owned by: | nacin |
---|---|---|---|
Milestone: | 3.9 | Priority: | normal |
Severity: | normal | Version: | 3.0 |
Component: | Date/Time | Keywords: | has-patch dev-feedback commit |
Focuses: | Cc: |
Description
Currently the get_the_date() function only utilizes the global $post. Allowing this function to accept an optional $post object as an argument would be beneficial for getting the formatted date of any post.
Attachments (7)
Change History (24)
#1
@
14 years ago
- Milestone changed from 3.0 to 3.1
We typically call get_post() and let it figure out whether to use the global.
No more enhancements for 3.0. Moving to 3.1.
#2
@
14 years ago
- Cc matt@… added
Thanks Ryan. I agree, I was just trying to trim the extra function calls; but after review it may not be worth the investment in time to set a precedent of allowing an optional $post arg in template tags, though I'll let you guys decide ;)
#3
@
14 years ago
- Keywords needs-patch added; date removed
- Milestone changed from Awaiting Triage to Future Release
#4
@
13 years ago
- Keywords has-patch added; needs-patch removed
Also cleaned up the code/docs a bit.
#8
follow-up:
↓ 9
@
11 years ago
Hey guys! Just added a new patch here. Let me know if there is anything else you need.
#9
in reply to:
↑ 8
@
11 years ago
- Keywords dev-feedback added
Replying to tanner m:
Hey guys! Just added a new patch here. Let me know if there is anything else you need.
Hey Tanner - this looks good, I added the word 'Optional' to the doc block description of the new $post variable, and also cleaned up the alignment a bit.
Thanks for contributing! A unit test would be nice here...
#10
@
11 years ago
13771.2.2.diff Adds a unit test verifying that get_the_date() returns the expected date when passed a post id (apologies for the funky filename).
#12
follow-up:
↓ 13
@
11 years ago
Nice work, tanner and adam. It looks like $post should also be passed to the get_the_date filter.
#13
in reply to:
↑ 12
@
11 years ago
Replying to nacin:
Nice work, tanner and adam. It looks like $post should also be passed to the get_the_date filter.
Thanks & good point! Added $post to the filter in 13771.3.diff and added a doc block above the filter since I was touching it anyway.
This ticket was mentioned in IRC in #wordpress-dev by tannermoushey. View the logs.
11 years ago
#15
follow-up:
↓ 16
@
11 years ago
- Keywords commit added
- Milestone changed from Future Release to 3.9
13771.3.diff seems to be in order. @adamsilverstein: nice work on the hook docs!
#16
in reply to:
↑ 15
@
11 years ago
Replying to DrewAPicture:
13771.3.diff seems to be in order. @adamsilverstein: nice work on the hook docs!
Yea! that is the first time i've written a hook doc you didn’t have to fix!
Patch for get_the_date() to accept optional $post arg.