#3876 closed enhancement (wontfix)
New template tag - get_latest_post
| Reported by: | drmike | Owned by: | |
|---|---|---|---|
| Priority: | lowest | Milestone: | |
| Component: | Template | Version: | |
| Severity: | trivial | Keywords: | |
| Cc: | Focuses: |
Description
Greets:
Just a quick mention that I would like to see the template tag get_latest_post. This would generate a link directly to the latest post. I'm thinking it woul be used in such places as a static front page.
Thanks,
-drmike
Change History (2)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
This should probably not be in the core when it's so easy to simply stick into a plugin or a theme or a page template or what have you.
<?php function get_latest_post_permalink() { $my_query = new WP_Query('showposts=1'); if ($my_query->have_posts()) { $latest_post = $my_query->next_post(); return get_permalink($latest_post->ID); } } ?>