This is an old version of this answer!
Return to the current answerPlace the following in your functions.php file for the active theme:
Then where you would normally put "wp_list_bookmarks", put "get_bookmarks_fresh" instead, like:
I have found that "link_updated" doesn't seem to be set correctly in a default WP install, which is why the 'edit_link_update' function is there.
Also, I should mention that editing core file like "/wp-includes/bookmark-template.php" is not such a great plan, as an upgrade may destroy your changes.
function edit_link_update($link_ID) {
global $wpdb;
$sql = "update wp_links set link_updated = NOW() where link_id = " . $link_ID . ";";
$wpdb->query($sql);
}
add_action('edit_link', 'edit_link_update');
function get_bookmarks_fresh($args, $days_old = 30) {
$bookmarks = get_bookmarks($args);
$str = '';
foreach ($bookmarks as $b) {
$datediff = ((((date('U') - date('U', strtotime($b->link_updated))) / 60) / 60) / 24);
$str .= '<li><a' . ($datediff <= $days_old ? ' class="new"' : '') . ' href="' . $b->link_url . '" title="' . $b->link_description . '">' . $b->link_name . '</a></li>';
}
echo $str;
}
Then where you would normally put "wp_list_bookmarks", put "get_bookmarks_fresh" instead, like:
get_bookmarks_fresh('orderby=name');
I have found that "link_updated" doesn't seem to be set correctly in a default WP install, which is why the 'edit_link_update' function is there.
Also, I should mention that editing core file like "/wp-includes/bookmark-template.php" is not such a great plan, as an upgrade may destroy your changes.
Japh | 01/08/10 at 3:08am





