Make WordPress Core

Opened 16 years ago

Closed 16 years ago

#3876 closed enhancement (wontfix)

New template tag - get_latest_post

Reported by: drmike's profile drmike Owned by:
Milestone: Priority: lowest
Severity: trivial Version:
Component: Template Keywords:
Focuses: Cc:

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)

#1 @Otto42
16 years ago

  • Component changed from Administration to Template
  • Priority changed from low to lowest
  • Severity changed from normal to trivial

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);
} }
?>

#2 @rob1n
16 years ago

  • Milestone 2.3 deleted
  • Resolution set to wontfix
  • Status changed from new to closed

I don't see the need for this. Just do:

get_posts('orderby=post_date&count=1');
Note: See TracTickets for help on using tickets.